aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/App
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2021-02-02 17:00:03 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2021-02-02 17:00:03 -0800
commitec8509295a8de19462ecd352a22b2784158e9ec6 (patch)
tree060fd44c287dcb41cb39f85a7347d956837529b6 /src/Text/Pandoc/App
parentaf77241b1761814285d63f72f345d60b74fc3d24 (diff)
downloadpandoc-ec8509295a8de19462ecd352a22b2784158e9ec6.tar.gz
Add parseOptionsFromArgs [API change, addition].
Exported by Text.Pandoc.App.
Diffstat (limited to 'src/Text/Pandoc/App')
-rw-r--r--src/Text/Pandoc/App/CommandLineOptions.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Text/Pandoc/App/CommandLineOptions.hs b/src/Text/Pandoc/App/CommandLineOptions.hs
index 307f28b5c..a4c510d97 100644
--- a/src/Text/Pandoc/App/CommandLineOptions.hs
+++ b/src/Text/Pandoc/App/CommandLineOptions.hs
@@ -17,6 +17,7 @@ Does a pandoc conversion based on command-line options.
-}
module Text.Pandoc.App.CommandLineOptions (
parseOptions
+ , parseOptionsFromArgs
, options
, engines
, lookupHighlightStyle
@@ -73,9 +74,13 @@ parseOptions :: [OptDescr (Opt -> IO Opt)] -> Opt -> IO Opt
parseOptions options' defaults = do
rawArgs <- map UTF8.decodeArg <$> getArgs
prg <- getProgName
+ parseOptionsFromArgs options' defaults prg rawArgs
+parseOptionsFromArgs
+ :: [OptDescr (Opt -> IO Opt)] -> Opt -> String -> [String] -> IO Opt
+parseOptionsFromArgs options' defaults prg rawArgs = do
let (actions, args, unrecognizedOpts, errors) =
- getOpt' Permute options' rawArgs
+ getOpt' Permute options' (map UTF8.decodeArg rawArgs)
let unknownOptionErrors =
foldr (handleUnrecognizedOption . takeWhile (/= '=')) []