From ef0713cbd90d6b84da7ea67e6dfc1fe5ab5bff86 Mon Sep 17 00:00:00 2001 From: Paul Oliver Date: Sun, 7 Sep 2025 13:43:15 +0000 Subject: Adds generic app launcher helper function --- hsm-core/Hsm/Core/App.hs | 9 +++++++++ hsm-core/Hsm/Core/Options.hs | 8 -------- 2 files changed, 9 insertions(+), 8 deletions(-) create mode 100644 hsm-core/Hsm/Core/App.hs delete mode 100644 hsm-core/Hsm/Core/Options.hs (limited to 'hsm-core/Hsm') diff --git a/hsm-core/Hsm/Core/App.hs b/hsm-core/Hsm/Core/App.hs new file mode 100644 index 0000000..12849d4 --- /dev/null +++ b/hsm-core/Hsm/Core/App.hs @@ -0,0 +1,9 @@ +module Hsm.Core.App + ( runApp + ) where + +import Effectful (Eff, IOE, runEff) +import Options.Applicative (Parser, (<**>), execParser, fullDesc, helper, info, progDesc) + +runApp :: Parser o -> String -> (o -> Eff '[ IOE] a) -> IO a +runApp parser desc app = execParser (info (parser <**> helper) $ fullDesc <> progDesc desc) >>= runEff . app diff --git a/hsm-core/Hsm/Core/Options.hs b/hsm-core/Hsm/Core/Options.hs deleted file mode 100644 index eeeee97..0000000 --- a/hsm-core/Hsm/Core/Options.hs +++ /dev/null @@ -1,8 +0,0 @@ -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 -- cgit v1.2.1