aboutsummaryrefslogtreecommitdiff
path: root/hsm-core
diff options
context:
space:
mode:
Diffstat (limited to 'hsm-core')
-rw-r--r--hsm-core/Hsm/Core/Options.hs8
-rw-r--r--hsm-core/hsm-core.cabal2
2 files changed, 10 insertions, 0 deletions
diff --git a/hsm-core/Hsm/Core/Options.hs b/hsm-core/Hsm/Core/Options.hs
new file mode 100644
index 0000000..eeeee97
--- /dev/null
+++ b/hsm-core/Hsm/Core/Options.hs
@@ -0,0 +1,8 @@
+module Hsm.Core.Options
+ ( getOptions
+ ) where
+
+import Options.Applicative (Parser, (<**>), execParser, fullDesc, helper, info, progDesc)
+
+getOptions :: Parser a -> String -> IO a
+getOptions parser desc = execParser . info (parser <**> helper) $ fullDesc <> progDesc desc
diff --git a/hsm-core/hsm-core.cabal b/hsm-core/hsm-core.cabal
index 67a63e2..e435f19 100644
--- a/hsm-core/hsm-core.cabal
+++ b/hsm-core/hsm-core.cabal
@@ -7,6 +7,7 @@ library
build-depends:
, base
, effectful-core
+ , optparse-applicative
, template-haskell
, transformers
@@ -14,5 +15,6 @@ library
exposed-modules:
Hsm.Core.Bracket
Hsm.Core.Serial
+ Hsm.Core.Options
ghc-options: -O2 -Wall -Werror -Wno-star-is-type -Wunused-packages