From 06c3928986c7b1a8463ac02de81ac64570f5afd6 Mon Sep 17 00:00:00 2001 From: Prat <616399+pt2121@users.noreply.github.com> Date: Tue, 30 Aug 2022 08:36:08 -0700 Subject: [PATCH] Produce error if --csl is used more than once (#8252) Closes #8195. Co-authored-by: Prat T --- src/Text/Pandoc/App/CommandLineOptions.hs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Text/Pandoc/App/CommandLineOptions.hs b/src/Text/Pandoc/App/CommandLineOptions.hs index 27300f369bf6..a25c22e284bf 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") ""