diff --git a/app/Main.hs b/app/Main.hs index 43f9c75..d71aedf 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -5,6 +5,8 @@ import Defaults import Defaults.Types (DomainName(..)) import Options.Applicative +import Relude.Extra (un) +import Data.Text (unpack) -- | Main main :: IO () @@ -25,6 +27,7 @@ commands = hsubparser (DomainName <$> strArgument ( metavar "DOMAIN..." <> help "Domain(s) that will be watched." + <> completer domainCompleter ) ) <|> flag' (watch =<< domains) @@ -45,8 +48,11 @@ commands = hsubparser (printKeys . DomainName <$> strArgument ( metavar "DOMAIN" <> help "A domain for which to list keys." + <> completer domainCompleter ) ) $ progDesc "List the current keys in a domain." ) ) + where + domainCompleter = listIOCompleter $ fmap (fmap unpack . un . toList) domains diff --git a/package.yaml b/package.yaml index 4c34a69..edd9cbc 100644 --- a/package.yaml +++ b/package.yaml @@ -42,6 +42,7 @@ executables: - -with-rtsopts=-N dependencies: - prefmanager + - relude - optparse-applicative tests: diff --git a/prefmanager.cabal b/prefmanager.cabal index 28f4eed..bb7755e 100644 --- a/prefmanager.cabal +++ b/prefmanager.cabal @@ -4,7 +4,7 @@ cabal-version: 1.12 -- -- see: https://github.com/sol/hpack -- --- hash: 4bc817bf57fae042a1b016e58f5362763ec47db040b12f0912db03d7ad80580f +-- hash: 4f3ba99c73e2d565d8ad37f7906383a7069cf9a60542054cce281b52138c5c6c name: prefmanager version: 0.1.0.0 @@ -63,6 +63,7 @@ executable prefmanager base-noprelude , optparse-applicative , prefmanager + , relude default-language: Haskell2010 test-suite prefmanager-test