1
0
Fork 0
mirror of https://github.com/malob/prefmanager.git synced 2024-12-14 11:57:49 +00:00

Add commandline domain completions

This commit is contained in:
Malo Bourgon 2023-06-28 18:34:44 -07:00
parent aa48eda3d4
commit eae1c9dc58
3 changed files with 9 additions and 1 deletions

View file

@ -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

View file

@ -42,6 +42,7 @@ executables:
- -with-rtsopts=-N
dependencies:
- prefmanager
- relude
- optparse-applicative
tests:

View file

@ -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