From 175b791529a960bf7df8bccb8876783076b3d321 Mon Sep 17 00:00:00 2001 From: Albert Krewinkel Date: Tue, 27 Sep 2022 11:59:52 +0200 Subject: 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. --- pandoc-server/src/Text/Pandoc/Server.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'pandoc-server/src/Text') 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 - -- cgit v1.2.3