mirror of
https://github.com/malob/prefmanager.git
synced 2024-12-14 11:57:49 +00:00
Add list-domains command
This commit is contained in:
parent
139f6ff959
commit
fa8eb3416c
2 changed files with 22 additions and 19 deletions
2
Setup.hs
2
Setup.hs
|
@ -1,2 +0,0 @@
|
|||
import Distribution.Simple
|
||||
main = defaultMain
|
39
app/Main.hs
39
app/Main.hs
|
@ -20,21 +20,26 @@ opts = info
|
|||
-- | App CLI commands
|
||||
commands :: Parser (IO ())
|
||||
commands = hsubparser
|
||||
(command "watch"
|
||||
(info
|
||||
( watch . S.fromList <$> some
|
||||
(Domain <$> strArgument
|
||||
( metavar "DOMAIN..."
|
||||
<> completer (listIOCompleter $ fmap coerce . S.toList <$> domains)
|
||||
<> help "Domain(s) that will be watched"
|
||||
)
|
||||
)
|
||||
<|> flag' (watch =<< domains)
|
||||
( long "all"
|
||||
<> short 'a'
|
||||
<> help "Watch all domains including NSGlobalDomain"
|
||||
)
|
||||
)
|
||||
(progDesc "Watch domain(s) for changes")
|
||||
)
|
||||
( command "watch"
|
||||
(info
|
||||
( watch . S.fromList <$> some
|
||||
(Domain <$> strArgument
|
||||
( metavar "DOMAIN..."
|
||||
<> completer (listIOCompleter $ fmap coerce . S.toList <$> domains)
|
||||
<> help "Domain(s) that will be watched"
|
||||
)
|
||||
)
|
||||
<|> flag' (watch =<< domains)
|
||||
( long "all"
|
||||
<> short 'a'
|
||||
<> help "Watch all domains including NSGlobalDomain"
|
||||
)
|
||||
)
|
||||
$ progDesc "Watch domain(s) for changes"
|
||||
)
|
||||
<> command "list-domains"
|
||||
(info
|
||||
(pure $ S.toList <$> domains >>= mapM_ (putStrLn . coerce))
|
||||
(progDesc "List all domains")
|
||||
)
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue