aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPrat <[email protected]>2022-08-30 08:36:08 -0700
committerGitHub <[email protected]>2022-08-30 08:36:08 -0700
commit06c3928986c7b1a8463ac02de81ac64570f5afd6 (patch)
tree160f0848afbd63dffbdb3a5cbe58ae957f7b2e03
parent9b6220c8ed2ae9ddcc58fb2a335c2597d79a6f85 (diff)
Produce error if --csl is used more than once (#8252)
Closes #8195. Co-authored-by: Prat T <[email protected]>
-rw-r--r--src/Text/Pandoc/App/CommandLineOptions.hs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/Text/Pandoc/App/CommandLineOptions.hs b/src/Text/Pandoc/App/CommandLineOptions.hs
index 27300f369..a25c22e28 100644
--- a/src/Text/Pandoc/App/CommandLineOptions.hs
+++ b/src/Text/Pandoc/App/CommandLineOptions.hs
@@ -727,10 +727,11 @@ options =
, Option "" ["csl"]
(ReqArg
- (\arg opt ->
- return opt{ optMetadata =
- addMeta "csl" (normalizePath arg) $
- optMetadata opt })
+ (\arg opt -> do
+ case lookupMeta (T.pack "csl") $ optMetadata opt of
+ Just _ -> E.throwIO $ PandocOptionError "Only one CSL file can be specified."
+ Nothing -> return opt{ optMetadata = addMeta "csl" (normalizePath arg) $
+ optMetadata opt })
"FILE")
""