aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2019-11-02 08:27:03 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2019-11-02 08:27:03 -0700
commit180c96f9a079b9d2586e66bb6c901e77e4427952 (patch)
treedd9db5ec515740d88c98e500d759c3770fc34662
parentcebf0091caae1a8615c236aa790ff8918e3c7d1e (diff)
downloadpandoc-180c96f9a079b9d2586e66bb6c901e77e4427952.tar.gz
Move extension-adding to applyDefaults
-rw-r--r--src/Text/Pandoc/App/CommandLineOptions.hs11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/Text/Pandoc/App/CommandLineOptions.hs b/src/Text/Pandoc/App/CommandLineOptions.hs
index 019ec9220..848f9fba5 100644
--- a/src/Text/Pandoc/App/CommandLineOptions.hs
+++ b/src/Text/Pandoc/App/CommandLineOptions.hs
@@ -161,11 +161,7 @@ options =
, Option "d" ["defaults"]
(ReqArg
- (\arg opt -> do
- let fp' = if null (takeExtension arg)
- then addExtension arg "yaml"
- else arg
- foldM applyDefaults opt [fp']
+ (\arg opt -> applyDefaults opt arg
)
"FILE")
""
@@ -982,7 +978,10 @@ splitField s =
-- | Apply defaults from --defaults file.
applyDefaults :: Opt -> FilePath -> IO Opt
-applyDefaults opt fp = runIOorExplode $ do
+applyDefaults opt file = runIOorExplode $ do
+ let fp = if null (takeExtension file)
+ then addExtension file "yaml"
+ else file
setVerbosity $ optVerbosity opt
dataDirs <- liftIO defaultUserDataDirs
let fps = case optDataDir opt of