aboutsummaryrefslogtreecommitdiff
path: root/hsm-web
diff options
context:
space:
mode:
Diffstat (limited to 'hsm-web')
-rw-r--r--hsm-web/Main.hs17
-rw-r--r--hsm-web/hsm-web.cabal3
2 files changed, 17 insertions, 3 deletions
diff --git a/hsm-web/Main.hs b/hsm-web/Main.hs
index 9eef1e7..d1a9da3 100644
--- a/hsm-web/Main.hs
+++ b/hsm-web/Main.hs
@@ -1,7 +1,20 @@
+{-# LANGUAGE TemplateHaskell #-}
+
import Effectful (runEff)
import Hsm.Cam (runCam)
-import Hsm.Log (Severity(Info), runLogs)
+import Hsm.Log (Severity(Info), runLogsOpt)
+import Hsm.Log.Options (makeLoggerOptionParser)
import Hsm.Web (runServer, runWeb)
+-- Import full module for cleaner `-ddump-splices` output
+-- Avoids package/module qualifiers in generated code
+import Options.Applicative
+
+type Loggers = '[ "cam", "libcamera", "scotty", "web"]
+
+$(makeLoggerOptionParser @Loggers "Options" "parser" 'Info)
+
main :: IO ()
-main = runEff . runLogs @'[ "cam", "libcamera", "scotty", "web"] Info . runCam . runWeb $ runServer
+main = do
+ opt <- execParser . info (parser <**> helper) $ fullDesc <> progDesc "Launch HsMouse Web Server"
+ runEff . runLogsOpt @Options @Loggers opt . runCam . runWeb $ runServer
diff --git a/hsm-web/hsm-web.cabal b/hsm-web/hsm-web.cabal
index 89d97e9..0e7bf02 100644
--- a/hsm-web/hsm-web.cabal
+++ b/hsm-web/hsm-web.cabal
@@ -29,13 +29,14 @@ executable hsm-web
, effectful-plugin
, hsm-cam
, hsm-log
+ , optparse-applicative
, scotty
, warp
default-language: GHC2024
ghc-options:
-O2 -threaded -Wall -Werror -Wno-star-is-type -Wunused-packages
- -fplugin=Effectful.Plugin
+ -ddump-splices -fplugin=Effectful.Plugin
if !arch(x86_64)
ghc-options: -optl=-mno-fix-cortex-a53-835769