Skip to main content

Module utils

Module utils 

Source
Expand description

Utility functions for CLI handlers

Helper functions for reading stdin, formatting status badges, and printing task contexts.

Functions§

get_status_badge
Get a status badge icon for task status (arrow style, used in ie status)
merge_metadata
Merge new metadata into existing metadata JSON string. Null values in new_meta mean “delete this key”.
parse_metadata
Parse metadata key=value strings into a JSON object. “key=value” sets a key, “key=” deletes a key.
parse_status_keywords
Check if query is a status keyword combination (todo, doing, done). Returns Some(statuses) if all words are valid status keywords, None otherwise.
parse_task_id_query
Check if query is a #ID format (e.g., "#123", "#1"). Returns Some(id) if it is a task ID query, None otherwise.
print_events_summary
Print events summary (recent events with count)
print_task_context
Print task context in a human-friendly tree format
print_task_summary
Print a concise task summary
print_task_tree
Print tasks in a hierarchical tree format
read_stdin
Read from stdin with proper encoding handling (especially for Windows PowerShell)
status_icon
Get a status icon for task status (bullet style, used in tree/list views)