Implement report system and fix template task filtering
- Fix template task filtering bug: templates now hidden from all reports except 'template' and 'all' reports, even when using custom filters - Add support for status:template filter to explicitly show templates - Implement comprehensive report system with 12 predefined reports: * active - Started tasks * all - All tasks including templates * completed - Completed tasks * list - Pending tasks (default) * minimal - Pending tasks in minimal format * newest - Most recent pending tasks * oldest - Oldest pending tasks * overdue - Overdue tasks * ready - Tasks ready to work on * recurring - Pending recurring instances * template - Recurring template tasks * waiting - Hidden/waiting tasks - Replace list command with report-based architecture - Add configurable default_report option (defaults to 'list') - Add minimal display format (ID + description only) - Support flexible syntax: 'opal <report> [filters]' or 'opal [filters] <report>' - Add 'opal reports' command to list all available reports
This commit is contained in:
@@ -11,10 +11,35 @@ import (
|
||||
|
||||
// FormatTaskList formats a list of tasks for display
|
||||
func FormatTaskList(tasks []*Task, ws *WorkingSet) string {
|
||||
return FormatTaskListWithFormat(tasks, ws, "table")
|
||||
}
|
||||
|
||||
// FormatTaskListWithFormat formats a list of tasks with specified format
|
||||
func FormatTaskListWithFormat(tasks []*Task, ws *WorkingSet, format string) string {
|
||||
if len(tasks) == 0 {
|
||||
return "No tasks found."
|
||||
}
|
||||
|
||||
// Minimal format: just ID and description
|
||||
if format == "minimal" {
|
||||
result := ""
|
||||
for i, task := range tasks {
|
||||
displayID := i + 1
|
||||
if ws != nil {
|
||||
// Use working set display ID if available
|
||||
for id, uuid := range ws.byID {
|
||||
if uuid == task.UUID {
|
||||
displayID = id
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
result += fmt.Sprintf("%3d %s\n", displayID, task.Description)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// Table format (default)
|
||||
t := table.NewWriter()
|
||||
|
||||
// Configure style
|
||||
|
||||
Reference in New Issue
Block a user