summaryrefslogtreecommitdiff
path: root/Omni
diff options
context:
space:
mode:
Diffstat (limited to 'Omni')
-rw-r--r--Omni/Task/Core.hs26
1 files changed, 14 insertions, 12 deletions
diff --git a/Omni/Task/Core.hs b/Omni/Task/Core.hs
index b322ea9..0351cf4 100644
--- a/Omni/Task/Core.hs
+++ b/Omni/Task/Core.hs
@@ -279,28 +279,30 @@ showTaskTree maybeId = do
printTreeNode :: [Task] -> Task -> Int -> IO ()
printTreeNode allTasks task indent = do
let prefix = T.pack (replicate (indent * 2) ' ')
- -- Only show type label for epics
- typeStr = case taskType task of
- Epic -> "[Epic] "
- WorkTask -> ""
- statusStr = case taskStatus task of
- Open -> "[ ]"
- InProgress -> "[~]"
- Done -> "[✓]"
+ children = filter (\t -> taskParent t == Just (taskId task)) allTasks
+ -- For epics, show progress count [completed/total]; for tasks, show status checkbox
+ statusStr = case taskType task of
+ Epic ->
+ let total = length children
+ completed = length <| filter (\t -> taskStatus t == Done) children
+ in "[" <> T.pack (show completed) <> "/" <> T.pack (show total) <> "]"
+ WorkTask -> case taskStatus task of
+ Open -> "[ ]"
+ InProgress -> "[~]"
+ Done -> "[✓]"
nsStr = case taskNamespace task of
Nothing -> ""
Just ns -> "[" <> ns <> "] "
-- Calculate available width for title (80 cols - prefix - id - labels)
- usedWidth = T.length prefix + T.length (taskId task) + T.length typeStr + T.length statusStr + T.length nsStr + 2
+ usedWidth = T.length prefix + T.length (taskId task) + T.length statusStr + T.length nsStr + 2
availableWidth = max 20 (80 - usedWidth)
truncatedTitle =
if T.length (taskTitle task) > availableWidth
then T.take (availableWidth - 3) (taskTitle task) <> "..."
else taskTitle task
- putText <| prefix <> taskId task <> " " <> typeStr <> statusStr <> " " <> nsStr <> truncatedTitle
+ putText <| prefix <> taskId task <> " " <> statusStr <> " " <> nsStr <> truncatedTitle
- -- Find and print children (tasks with this task as parent)
- let children = filter (\t -> taskParent t == Just (taskId task)) allTasks
+ -- Print children
traverse_ (\child -> printTreeNode allTasks child (indent + 1)) children
-- Helper to print a task