diff options
| author | John MacFarlane <[email protected]> | 2022-10-31 09:59:36 -0700 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2022-10-31 11:29:23 -0700 |
| commit | 4a47ffb8ba5f67b5e0e430aa65252a67838a0a92 (patch) | |
| tree | 35746986f597d59b2ecde73df801fc92905ef7d7 /pandoc-cli | |
| parent | 3e48d9701d955dc1df27f9cfd2eb5111b2cd9c1f (diff) | |
Text.Pandoc.App: Change `parseOptionsFromArgs` and `parseOptions`...optinfo
They now return `Either OptInfo Opt`.
Add `OptInfo` type.
Add `handleOptInfo` function. This performs the IO actions for
things like `--version` that were previously done in `parseOptionsFromArgs`.
An argument for a `ScriptingEngine` has been added, to facilitate
printing custom templates and custom extensions for Lua filters.
(However, at this stage nothing is yet done with it.)
[API change]
Diffstat (limited to 'pandoc-cli')
| -rw-r--r-- | pandoc-cli/src/pandoc.hs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/pandoc-cli/src/pandoc.hs b/pandoc-cli/src/pandoc.hs index 3c0889d8e..6bf54bda3 100644 --- a/pandoc-cli/src/pandoc.hs +++ b/pandoc-cli/src/pandoc.hs @@ -16,7 +16,7 @@ module Main where import qualified Control.Exception as E import System.Environment (getArgs, getProgName) import Text.Pandoc.App ( convertWithOpts, defaultOpts, options - , parseOptionsFromArgs ) + , parseOptionsFromArgs, handleOptInfo ) import Text.Pandoc.Error (handleError) import qualified Text.Pandoc.UTF8 as UTF8 import System.Exit (exitSuccess) @@ -61,10 +61,12 @@ main = E.handle (handleError . Left) $ do case rawArgs of "lua" : args -> runLuaInterpreter "pandoc lua" args "server": args -> runServer args - _ -> do + args -> do engine <- getEngine - opts <- parseOptionsFromArgs options defaultOpts prg rawArgs - convertWithOpts engine opts + res <- parseOptionsFromArgs options defaultOpts prg args + case res of + Left e -> handleOptInfo engine e + Right opts -> convertWithOpts engine opts copyrightMessage :: String copyrightMessage = |
