git.iko.soy/typeable/pandoc
on master help sign in
Move extension-adding to applyDefaults
commit180c96f9a079b9d2586e66bb6c901e77e4427952 authorJohn MacFarlane <jgm@berkeley.edu> dateSat 2 Nov 2019, 08:27 (7 years ago) parentcebf009
1 file changed+5−6
src/Text/Pandoc/App/CommandLineOptions.hs+5−6
src/Text/Pandoc/App/CommandLineOptions.hs+5−6
@@ -161,11 +161,7 @@ options =
161161
162162 , Option "d" ["defaults"]
163163 (ReqArg
164− (\arg opt -> do
165− let fp' = if null (takeExtension arg)
166− then addExtension arg "yaml"
167− else arg
168− foldM applyDefaults opt [fp']
164+ (\arg opt -> applyDefaults opt arg
169165 )
170166 "FILE")
171167 ""
@@ -982,7 +978,10 @@ splitField s =
982978
983979-- | Apply defaults from --defaults file.
984980applyDefaults :: Opt -> FilePath -> IO Opt
985−applyDefaults opt fp = runIOorExplode $ do
981+applyDefaults opt file = runIOorExplode $ do
982+ let fp = if null (takeExtension file)
983+ then addExtension file "yaml"
984+ else file
986985 setVerbosity $ optVerbosity opt
987986 dataDirs <- liftIO defaultUserDataDirs
988987 let fps = case optDataDir opt of