Skip to content

Commit 10f8cf6

Browse files
committed
Show descriptive variable names in brief help text
1 parent c52df72 commit 10f8cf6

File tree

1 file changed

+28
-11
lines changed

1 file changed

+28
-11
lines changed

tasklite-core/app/Main.hs

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import Data.Yaml (decodeFileEither, prettyPrintParseException)
2323
import GHC.IO.Encoding (setLocaleEncoding, utf8)
2424
import GitHash
2525
import Options.Applicative
26-
import Paths_tasklite_core
26+
import Paths_tasklite_core ()
2727
import System.Directory
2828
( createDirectoryIfMissing
2929
, getHomeDirectory
@@ -68,6 +68,7 @@ data Command
6868
| RepeatTasks Duration [IdText]
6969
| BoostTasks [IdText]
7070
| HushTasks [IdText]
71+
-- | Modify [IdText] Text -- DSL for modifying a task
7172

7273
{- Modify With Parameter -}
7374
| Prioritize Float [IdText]
@@ -93,7 +94,7 @@ data Command
9394
| Ndjson
9495
| Sql
9596
| Backup
96-
-- | Fork -- Create a new SQLite database with the tasks of the specified query
97+
-- | Fork -- Create new SQLite database with the tasks of the specified query
9798

9899
{- List -}
99100
| ListAll
@@ -234,7 +235,9 @@ commandParser conf =
234235
in
235236
(pure ListReady)
236237
<|>
237-
( subparser ( commandGroup (T.unpack $ fst basic_sec)
238+
( subparser
239+
( metavar (T.unpack $ snd basic_sec)
240+
<> commandGroup (T.unpack $ fst basic_sec)
238241

239242
<> command "add" (toParserInfo (AddTask <$> some (strArgument
240243
(metavar "BODY" <> help "Body of the task")))
@@ -254,7 +257,7 @@ commandParser conf =
254257
"Set ready UTC of tasks")
255258

256259
<> command "wait" (toParserInfo (WaitTasks <$> some (strArgument idsVar))
257-
"Mark a task as waiting (e.g. waiting for feedback)")
260+
"Mark a task as waiting (e.g. for feedback) and review it in 3 days")
258261

259262
<> command "waitfor" (toParserInfo (WaitFor
260263
<$> argument (maybeReader parseDurationInDays)
@@ -364,7 +367,9 @@ commandParser conf =
364367
-- \with a timer of the past time since you started the task")
365368
)
366369

367-
<|> subparser ( commandGroup (T.unpack $ fst shortcut_sec)
370+
<|> subparser
371+
( metavar (T.unpack $ snd shortcut_sec)
372+
<> commandGroup (T.unpack $ fst shortcut_sec)
368373

369374
<> command "write" (toParserInfo (AddWrite <$> some (strArgument
370375
(metavar "BODY" <> help "Body of the task")))
@@ -400,7 +405,9 @@ commandParser conf =
400405
"Ship an item to someone")
401406
)
402407

403-
<|> subparser ( commandGroup (T.unpack $ fst list_sec)
408+
<|> subparser
409+
( metavar (T.unpack $ snd list_sec)
410+
<> commandGroup (T.unpack $ fst list_sec)
404411

405412
<> command "head" (toParserInfo (pure ListHead)
406413
("List " <> numTasks <> " most important open tasks by priority desc"))
@@ -516,7 +523,9 @@ commandParser conf =
516523
-- <> command "unblocked" -- Tasks that are not blocked (by priority)
517524
)
518525

519-
<|> subparser ( commandGroup (T.unpack $ fst vis_sec)
526+
<|> subparser
527+
( metavar (T.unpack $ snd vis_sec)
528+
<> commandGroup (T.unpack $ fst vis_sec)
520529
-- <> command "kanban" -- "List tasks columnized by state"
521530
-- <> command "burndown" -- "Burndown chart by week"
522531
-- <> command "calendar" -- "Calendar view of all open tasks"
@@ -535,7 +544,9 @@ commandParser conf =
535544

536545
)
537546

538-
<|> subparser ( commandGroup (T.unpack $ fst i_o_sec)
547+
<|> subparser
548+
( metavar (T.unpack $ snd i_o_sec)
549+
<> commandGroup (T.unpack $ fst i_o_sec)
539550

540551
<> command "import" (toParserInfo (pure Import)
541552
"Import one JSON task from stdin")
@@ -557,7 +568,9 @@ commandParser conf =
557568
"Create a backup of the tasks database at ~/tasklite/backups")
558569
)
559570

560-
<|> subparser ( commandGroup (T.unpack $ fst advanced_sec)
571+
<|> subparser
572+
( metavar (T.unpack $ snd advanced_sec)
573+
<> commandGroup (T.unpack $ fst advanced_sec)
561574

562575
<> command "count"
563576
(toParserInfo
@@ -576,7 +589,9 @@ commandParser conf =
576589
<> command "help" (toParserInfo (pure Help) "Display current help page")
577590
)
578591

579-
<|> subparser ( commandGroup (T.unpack $ fst unset_sec)
592+
<|> subparser
593+
( metavar (T.unpack $ snd unset_sec)
594+
<> commandGroup (T.unpack $ fst unset_sec)
580595

581596
-- <> command "unclose"
582597
-- "Delete closed UTC and delete Obsolete / Done state"
@@ -738,7 +753,9 @@ helpText conf =
738753
& spliceDocsIntoText helpReplacements
739754
& hcat
740755
in
741-
case (parserFailure defaultPrefs (commandParserInfo conf) ShowHelpText mempty) of
756+
case
757+
(parserFailure defaultPrefs (commandParserInfo conf) ShowHelpText mempty)
758+
of
742759
ParserFailure a -> case a "tasklite" of
743760
(theHelp, _, _) -> extendHelp theHelp
744761

0 commit comments

Comments
 (0)