diff options
| author | John MacFarlane <[email protected]> | 2022-10-13 17:59:49 -0700 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2022-10-13 17:59:49 -0700 |
| commit | f486fcde13306aeb818b6db830bc86c4372ace57 (patch) | |
| tree | 1f5a9e52d438f288343e0e8281a0a272475cb415 | |
| parent | 14c7b5db20e8864f745cc95fb71c08befe49da0c (diff) | |
Rollback parameterize options on scripting engine.
Rolls back 0ab014ed1e5890e338792fab98aecc45cd889f99.
We don't need this because we aren't needing to print the Lua
version in options any more; we're handling `--version` now at
the pandoc-cli level.
| -rw-r--r-- | pandoc-cli/src/pandoc.hs | 3 | ||||
| -rw-r--r-- | src/Text/Pandoc/App/CommandLineOptions.hs | 14 | ||||
| -rw-r--r-- | test/test-pandoc.hs | 2 |
3 files changed, 7 insertions, 12 deletions
diff --git a/pandoc-cli/src/pandoc.hs b/pandoc-cli/src/pandoc.hs index 244727719..274b1c567 100644 --- a/pandoc-cli/src/pandoc.hs +++ b/pandoc-cli/src/pandoc.hs @@ -62,8 +62,7 @@ main = E.handle (handleError . Left) $ do "server": args -> runServer args _ -> do engine <- getEngine - let cliOpts = options engine - opts <- parseOptionsFromArgs cliOpts defaultOpts prg rawArgs + opts <- parseOptionsFromArgs options defaultOpts prg rawArgs convertWithOpts engine opts copyrightMessage :: String diff --git a/src/Text/Pandoc/App/CommandLineOptions.hs b/src/Text/Pandoc/App/CommandLineOptions.hs index a9afec7f6..5142ab3b2 100644 --- a/src/Text/Pandoc/App/CommandLineOptions.hs +++ b/src/Text/Pandoc/App/CommandLineOptions.hs @@ -52,7 +52,6 @@ import Text.Pandoc.App.Opt (Opt (..), LineEnding (..), IpynbOutput (..), fullDefaultsPath) import Text.Pandoc.Filter (Filter (..)) import Text.Pandoc.Highlighting (highlightingStyles, lookupHighlightingStyle) -import Text.Pandoc.Scripting (ScriptingEngine (engineName)) import Text.Pandoc.Shared (ordNub, elemText, safeStrRead, defaultUserDataDir) import Text.Printf import qualified Control.Exception as E @@ -122,8 +121,8 @@ pdfEngines = ordNub $ map snd engines -- | A list of functions, each transforming the options data structure -- in response to a command-line option. -options :: ScriptingEngine -> [OptDescr (Opt -> IO Opt)] -options scriptingEngine = +options :: [OptDescr (Opt -> IO Opt)] +options = [ Option "fr" ["from","read"] (ReqArg (\arg opt -> return opt { optFrom = @@ -805,8 +804,7 @@ options scriptingEngine = let optnames (Option shorts longs _ _) = map (\c -> ['-',c]) shorts ++ map ("--" ++) longs - let allopts = unwords (concatMap optnames - (options scriptingEngine)) + let allopts = unwords (concatMap optnames options) UTF8.hPutStrLn stdout $ T.pack $ printf tpl allopts (T.unpack $ T.unwords readersNames) (T.unpack $ T.unwords writersNames) @@ -941,8 +939,7 @@ options scriptingEngine = UTF8.hPutStrLn stdout $ T.pack $ prg ++ " " ++ T.unpack pandocVersionText ++ - compileInfo ++ "\nScripting engine: " ++ - T.unpack (engineName scriptingEngine) ++ + compileInfo ++ "\nUser data directory: " ++ defaultDatadir ++ ('\n':copyrightMessage) exitSuccess )) @@ -952,8 +949,7 @@ options scriptingEngine = (NoArg (\_ -> do prg <- getProgName - UTF8.hPutStr stdout (T.pack $ usageMessage prg - (options scriptingEngine)) + UTF8.hPutStr stdout (T.pack $ usageMessage prg options) exitSuccess )) "" -- "Show help" ] diff --git a/test/test-pandoc.hs b/test/test-pandoc.hs index 73841d29b..80b5e45ed 100644 --- a/test/test-pandoc.hs +++ b/test/test-pandoc.hs @@ -107,7 +107,7 @@ main = do case args of "--emulate":args' -> -- emulate pandoc executable E.catch - (parseOptionsFromArgs (options noEngine) defaultOpts "pandoc" args' + (parseOptionsFromArgs options defaultOpts "pandoc" args' >>= convertWithOpts noEngine) (handleError . Left) _ -> inDirectory "test" $ do |
