aboutsummaryrefslogtreecommitdiff
path: root/pandoc-server/src/Text/Pandoc
diff options
context:
space:
mode:
authorAlbert Krewinkel <[email protected]>2022-09-27 11:59:52 +0200
committerJohn MacFarlane <[email protected]>2022-09-27 08:42:27 -0700
commit175b791529a960bf7df8bccb8876783076b3d321 (patch)
tree17df31777977ce93e22960b8796c56bde3967e7e /pandoc-server/src/Text/Pandoc
parenta3fd6c674d233f949f070ff10c131f3713b78b4e (diff)
pandoc-cli: support "lua" and "serve" as commands
Pandoc behaves like `pandoc-lua` and `pandoc-server` if the first argument is `lua` and `serve`, respectively.
Diffstat (limited to 'pandoc-server/src/Text/Pandoc')
-rw-r--r--pandoc-server/src/Text/Pandoc/Server.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/pandoc-server/src/Text/Pandoc/Server.hs b/pandoc-server/src/Text/Pandoc/Server.hs
index 04dffb12a..9b6f4eedc 100644
--- a/pandoc-server/src/Text/Pandoc/Server.hs
+++ b/pandoc-server/src/Text/Pandoc/Server.hs
@@ -10,6 +10,7 @@ module Text.Pandoc.Server
, Params(..)
, Blob(..)
, parseServerOpts
+ , parseServerOptsFromArgs
) where
import Data.Aeson
@@ -94,6 +95,10 @@ cliOptions =
parseServerOpts :: IO ServerOpts
parseServerOpts = do
args <- getArgs
+ parseServerOptsFromArgs args
+
+parseServerOptsFromArgs :: [String] -> IO ServerOpts
+parseServerOptsFromArgs args = do
let handleUnknownOpt x = "Unknown option: " <> x
case getOpt' Permute cliOptions args of
(os, ns, unrecognizedOpts, es) -> do
@@ -426,4 +431,3 @@ server = convertBytes
case res of
Left e -> throwError $ PandocTemplateError (T.pack e)
Right tpl -> return tpl
-