From e668661180ea34723563193e7838fc44c4f567e7 Mon Sep 17 00:00:00 2001 From: Jens Nolte <jens@nightmarestudio.de> Date: Sun, 1 Mar 2020 18:52:19 +0100 Subject: [PATCH] Improve block parser cli --- src/QBar/Cli.hs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/QBar/Cli.hs b/src/QBar/Cli.hs index 7ee51a0..e538907 100644 --- a/src/QBar/Cli.hs +++ b/src/QBar/Cli.hs @@ -64,19 +64,21 @@ barConfigurationParser = do pure $ sequence_ blocks blockParser :: Parser (BarIO ()) -blockParser = subparser ( - commandGroup "Available blocks:" <> - command "date" (info (pure $ addBlock dateBlock) (progDesc "Load the date and time block.")) <> - command "cpu" (info (pure $ addBlock $ cpuUsageBlock 1) (progDesc "Load the cpu usage block.")) <> - command "script" (info scriptBlockParser (progDesc "Display the output of an external script as a block.")) - ) - <|> +blockParser = subparser ( - hidden <> commandGroup "Available presets:" <> + metavar "CONFIG..." <> command "default" (info (pure defaultBarConfig) (progDesc "Load default set of blocks.")) <> command "legacy" (info (pure legacyBarConfig) (progDesc "Load the legacy configuration. Requires some custom block scripts.")) ) + <|> + subparser ( + commandGroup "Available blocks:" <> + hidden <> + command "date" (info (pure $ addBlock dateBlock) (progDesc "Load the date and time block.")) <> + command "cpu" (info (pure $ addBlock $ cpuUsageBlock 1) (progDesc "Load the cpu usage block.")) <> + command "script" (info scriptBlockParser (progDesc "Display the output of an external script as a block.")) + ) scriptBlockParser :: Parser (BarIO ()) scriptBlockParser = helper <*> do -- GitLab