aboutsummaryrefslogtreecommitdiff
path: root/pandoc-cli/server
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-cli/server
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-cli/server')
-rw-r--r--pandoc-cli/server/PandocCLI/Server.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/pandoc-cli/server/PandocCLI/Server.hs b/pandoc-cli/server/PandocCLI/Server.hs
index ce9b4e8d0..3f04ab1b0 100644
--- a/pandoc-cli/server/PandocCLI/Server.hs
+++ b/pandoc-cli/server/PandocCLI/Server.hs
@@ -17,7 +17,7 @@ import qualified Network.Wai.Handler.Warp as Warp
import Network.Wai.Middleware.Timeout (timeout)
import Safe (readDef)
import System.Environment (lookupEnv)
-import Text.Pandoc.Server (ServerOpts(..), parseServerOpts, app)
+import Text.Pandoc.Server (ServerOpts(..), parseServerOptsFromArgs, app)
-- | Runs the CGI server.
runCGI :: IO ()
@@ -26,7 +26,7 @@ runCGI = do
CGI.run (timeout cgiTimeout app)
-- | Runs the HTTP server.
-runServer :: IO ()
-runServer = do
- sopts <- parseServerOpts
+runServer :: [String] -> IO ()
+runServer args = do
+ sopts <- parseServerOptsFromArgs args
Warp.run (serverPort sopts) (timeout (serverTimeout sopts) app)