summaryrefslogtreecommitdiff
path: root/Omni/Task
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2025-11-09 09:22:34 -0500
committerBen Sima <ben@bsima.me>2025-11-09 09:22:34 -0500
commitb2767b50b8a0d7987eef419709c8d5b467f8e33e (patch)
tree65d4968cdcb360604976afa88e39d17a16e33202 /Omni/Task
parent7d7be88312c47761fb0892e9329520bfc37e7177 (diff)
Improve task tree visualization display
Changes: 1. Remove [Task] label - only show [Epic] for epics, cleaner output 2. Truncate long titles to fit 80 columns with ... ellipsis 3. Better spacing with type label included in layout calculation Created task for future improvement: prettier box-drawing characters (├──, └──) which would require Data.Tree library investigation. Current output is clean and readable within standard terminal width.
Diffstat (limited to 'Omni/Task')
-rw-r--r--Omni/Task/Core.hs14
1 files changed, 11 insertions, 3 deletions
diff --git a/Omni/Task/Core.hs b/Omni/Task/Core.hs
index 1a9cb2e..ef60ead 100644
--- a/Omni/Task/Core.hs
+++ b/Omni/Task/Core.hs
@@ -279,9 +279,10 @@ 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 -> "[Task]"
+ Epic -> "[Epic] "
+ WorkTask -> ""
statusStr = case taskStatus task of
Open -> "[ ]"
InProgress -> "[~]"
@@ -289,7 +290,14 @@ showTaskTree maybeId = do
nsStr = case taskNamespace task of
Nothing -> ""
Just ns -> " [" <> ns <> "]"
- putText <| prefix <> taskId task <> " " <> typeStr <> " " <> statusStr <> " " <> taskTitle task <> nsStr
+ -- 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 + 3
+ 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 <> " " <> truncatedTitle <> nsStr
-- Find and print children (tasks with this task as parent)
let children = filter (\t -> taskParent t == Just (taskId task)) allTasks