Don't read sources until in/out format are verified.

Partially addresses #7797.
This commit is contained in:
John MacFarlane 2022-01-03 10:16:07 -08:00
parent 811eee7cad
commit 75c5218d4f

View file

@ -116,8 +116,6 @@ convertWithOpts opts = do
setInputFiles (fromMaybe ["-"] (optInputFiles opts))
setOutputFile (optOutputFile opts)
inputs <- readSources sources
-- assign reader and writer based on options and filenames
readerName <- case optFrom opts of
Just f -> return f
@ -282,6 +280,9 @@ convertWithOpts opts = do
(optCitationAbbreviations opts) $ mempty
let filterEnv = Environment readerOpts writerOptions
inputs <- readSources sources
doc <- (case reader of
TextReader r
| readerNameBase == "json" ->