diff options
Diffstat (limited to 'Omni/Task.hs')
| -rw-r--r-- | Omni/Task.hs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Omni/Task.hs b/Omni/Task.hs index 6d2da71..bbb78bb 100644 --- a/Omni/Task.hs +++ b/Omni/Task.hs @@ -45,6 +45,7 @@ Usage: task update <id> <status> [--json] task deps <id> [--json] task tree [<id>] [--json] + task stats [--json] task export [--flush] task import -i <file> task sync @@ -60,6 +61,7 @@ Commands: update Update task status deps Show dependency tree tree Show task tree (epics with children, or all epics if no ID given) + stats Show task statistics export Export and consolidate tasks to JSONL import Import tasks from JSONL file sync Export and commit tasks to git (does NOT push) @@ -227,6 +229,12 @@ move args tree <- getTaskTree maybeId outputJson tree else showTaskTree maybeId + | args `Cli.has` Cli.command "stats" = do + if isJsonMode args + then do + stats <- getTaskStats + outputJson stats + else showTaskStats | args `Cli.has` Cli.command "export" = do exportTasks putText "Exported and consolidated tasks to .tasks/tasks.jsonl" @@ -454,6 +462,18 @@ cliTests = case result of Left err -> Test.assertFailure <| "Failed to parse 'sync': " <> show err Right args -> args `Cli.has` Cli.command "sync" Test.@?= True, + Test.unit "stats command" <| do + let result = Docopt.parseArgs help ["stats"] + case result of + Left err -> Test.assertFailure <| "Failed to parse 'stats': " <> show err + Right args -> args `Cli.has` Cli.command "stats" Test.@?= True, + Test.unit "stats with --json flag" <| do + let result = Docopt.parseArgs help ["stats", "--json"] + case result of + Left err -> Test.assertFailure <| "Failed to parse 'stats --json': " <> show err + Right args -> do + args `Cli.has` Cli.command "stats" Test.@?= True + args `Cli.has` Cli.longOption "json" Test.@?= True, Test.unit "create with flags in different order" <| do let result = Docopt.parseArgs help ["create", "Test", "--json", "--priority=1", "--namespace=Omni/Task"] case result of |
