aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2019-11-01 21:48:30 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2019-11-01 21:48:30 -0700
commit02c579ff3c8256f2e3529f76a6f665a85fec084d (patch)
tree3282f7310f45a03d79506eb8418153855f966e79 /src/Text/Pandoc
parente96f3fd813b3f8b73c3457ff6e9177e2a4a74164 (diff)
downloadpandoc-02c579ff3c8256f2e3529f76a6f665a85fec084d.tar.gz
Revert "ALlow multiple comma-separated files for `--defaults`."
This reverts commit e96f3fd813b3f8b73c3457ff6e9177e2a4a74164.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/App/CommandLineOptions.hs13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/Text/Pandoc/App/CommandLineOptions.hs b/src/Text/Pandoc/App/CommandLineOptions.hs
index cf5fb51dc..019ec9220 100644
--- a/src/Text/Pandoc/App/CommandLineOptions.hs
+++ b/src/Text/Pandoc/App/CommandLineOptions.hs
@@ -64,7 +64,6 @@ import Data.Text (Text)
import Text.DocTemplates (ToContext(toVal), Context(..))
import qualified Text.Pandoc.UTF8 as UTF8
import qualified Data.YAML as Y
-import Data.List.Split (splitWhen)
parseOptions :: [OptDescr (Opt -> IO Opt)] -> Opt -> IO Opt
parseOptions options' defaults = do
@@ -162,8 +161,11 @@ options =
, Option "d" ["defaults"]
(ReqArg
- (\arg opt ->
- foldM applyDefaults opt (splitWhen (==',') arg)
+ (\arg opt -> do
+ let fp' = if null (takeExtension arg)
+ then addExtension arg "yaml"
+ else arg
+ foldM applyDefaults opt [fp']
)
"FILE")
""
@@ -980,10 +982,7 @@ splitField s =
-- | Apply defaults from --defaults file.
applyDefaults :: Opt -> FilePath -> IO Opt
-applyDefaults opt filepath = runIOorExplode $ do
- let fp = if null (takeExtension filepath)
- then addExtension filepath "yaml"
- else filepath
+applyDefaults opt fp = runIOorExplode $ do
setVerbosity $ optVerbosity opt
dataDirs <- liftIO defaultUserDataDirs
let fps = case optDataDir opt of