diff options
| author | Ben Sima <ben@bsima.me> | 2025-11-21 00:49:19 -0500 |
|---|---|---|
| committer | Ben Sima <ben@bsima.me> | 2025-11-21 00:49:19 -0500 |
| commit | 62728ac31f4a5a86678bf8830bf76b7ebf05436f (patch) | |
| tree | b06b431b0dbe8e858d339c6b0f9c1fbc86c85cd3 /Omni/Task.hs | |
| parent | 5d8c049eadc14d0e782fededea4ac913a9dbbc78 (diff) | |
feat: implement t-1rcIwc8
Diffstat (limited to 'Omni/Task.hs')
| -rw-r--r-- | Omni/Task.hs | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/Omni/Task.hs b/Omni/Task.hs index 24e528b..8151487 100644 --- a/Omni/Task.hs +++ b/Omni/Task.hs @@ -45,7 +45,7 @@ Usage: task update <id> <status> [--json] task deps <id> [--json] task tree [<id>] [--json] - task stats [--json] + task stats [--epic=<id>] [--json] task export [--flush] task import -i <file> task sync @@ -73,6 +73,7 @@ Options: --parent=<id> Parent epic ID --priority=<p> Priority: 0-4 (0=critical, 4=backlog, default: 2) --status=<status> Filter by status: open, in-progress, review, done + --epic=<id> Filter stats by epic (recursive) --deps=<ids> Comma-separated list of dependency IDs --dep-type=<type> Dependency type: blocks, discovered-from, parent-child, related (default: blocks) --discovered-from=<id> Shortcut for --deps=<id> --dep-type=discovered-from @@ -232,11 +233,14 @@ move args outputJson tree else showTaskTree maybeId | args `Cli.has` Cli.command "stats" = do + maybeEpic <- case Cli.getArg args (Cli.longOption "epic") of + Nothing -> pure Nothing + Just e -> pure <| Just (T.pack e) if isJsonMode args then do - stats <- getTaskStats + stats <- getTaskStats maybeEpic outputJson stats - else showTaskStats + else showTaskStats maybeEpic | args `Cli.has` Cli.command "export" = do exportTasks putText "Exported and consolidated tasks to .tasks/tasks.jsonl" @@ -516,6 +520,13 @@ cliTests = Right args -> do args `Cli.has` Cli.command "stats" Test.@?= True args `Cli.has` Cli.longOption "json" Test.@?= True, + Test.unit "stats with --epic flag" <| do + let result = Docopt.parseArgs help ["stats", "--epic=t-abc123"] + case result of + Left err -> Test.assertFailure <| "Failed to parse 'stats --epic': " <> show err + Right args -> do + args `Cli.has` Cli.command "stats" Test.@?= True + Cli.getArg args (Cli.longOption "epic") Test.@?= Just "t-abc123", 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 |
