From 054e3f2c1611250664105f5b6b6db97adb41643b Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Thu, 20 Nov 2025 11:37:45 -0500 Subject: Add task show command for detailed task inspection - Implemented 'task show ' command with human-readable output - Shows all task fields: title, type, status, priority, timestamps - Displays dependencies with their types - Supports --json flag for programmatic use - Added CLI tests for show command - Includes priority descriptions (Critical/High/Medium/Low/Backlog) --- Omni/Task.hs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'Omni/Task.hs') diff --git a/Omni/Task.hs b/Omni/Task.hs index e3f89dc..656c972 100644 --- a/Omni/Task.hs +++ b/Omni/Task.hs @@ -41,6 +41,7 @@ Usage: task create [--type=<type>] [--parent=<id>] [--priority=<p>] [--deps=<ids>] [--dep-type=<type>] [--discovered-from=<id>] [--namespace=<ns>] [--json] task list [--type=<type>] [--parent=<id>] [--status=<status>] [--namespace=<ns>] [--json] task ready [--json] + task show <id> [--json] task update <id> <status> [--json] task deps <id> [--json] task tree [<id>] [--json] @@ -55,6 +56,7 @@ Commands: create Create a new task or epic list List all tasks ready Show ready tasks (not blocked) + show Show detailed task information update Update task status deps Show dependency tree tree Show task tree (epics with children, or all epics if no ID given) @@ -186,6 +188,15 @@ move args else do putText "Ready tasks:" traverse_ printTask tasks + | args `Cli.has` Cli.command "show" = do + tid <- getArgText args "id" + tasks <- loadTasks + case filter (\t -> taskId t == tid) tasks of + [] -> putText "Task not found" + (task : _) -> + if isJsonMode args + then outputJson task + else showTaskDetailed task | args `Cli.has` Cli.command "update" = do tid <- getArgText args "id" statusStr <- getArgText args "status" @@ -424,6 +435,20 @@ cliTests = args `Cli.has` Cli.command "import" Test.@?= True -- Note: -i is a short option, not an argument Cli.getArg args (Cli.shortOption 'i') Test.@?= Just "tasks.jsonl", + Test.unit "show command" <| do + let result = Docopt.parseArgs help ["show", "t-abc123"] + case result of + Left err -> Test.assertFailure <| "Failed to parse 'show': " <> show err + Right args -> do + args `Cli.has` Cli.command "show" Test.@?= True + Cli.getArg args (Cli.argument "id") Test.@?= Just "t-abc123", + Test.unit "show with --json flag" <| do + let result = Docopt.parseArgs help ["show", "t-abc123", "--json"] + case result of + Left err -> Test.assertFailure <| "Failed to parse 'show --json': " <> show err + Right args -> do + args `Cli.has` Cli.command "show" Test.@?= True + args `Cli.has` Cli.longOption "json" Test.@?= True, Test.unit "sync command" <| do let result = Docopt.parseArgs help ["sync"] case result of -- cgit v1.2.3