feat(v0.3): add --projects flag to ctask list

ctask list shows tasks by default and projects with --projects.
--all controls archived visibility (independent of --projects),
so the four combinations work as the spec defines:
  - ctask list                  active tasks
  - ctask list --all            active + archived tasks
  - ctask list --projects       active projects
  - ctask list --projects --all active + archived projects

Empty-result message reflects the active filter.
This commit is contained in:
2026-04-10 14:50:43 -04:00
parent bfe89d830c
commit 1be121813e
+8 -1
View File
@@ -23,10 +23,12 @@ var (
listAll bool
listCategory string
listLimit int
listProjects bool
)
func init() {
listCmd.Flags().BoolVarP(&listAll, "all", "a", false, "Include archived workspaces")
listCmd.Flags().BoolVar(&listProjects, "projects", false, "Show projects instead of tasks")
listCmd.Flags().StringVarP(&listCategory, "category", "c", "", "Filter by category")
listCmd.Flags().IntVarP(&listLimit, "limit", "n", 20, "Maximum entries to show")
rootCmd.AddCommand(listCmd)
@@ -39,13 +41,18 @@ func runList(cmd *cobra.Command, args []string) error {
IncludeArchived: listAll,
Category: listCategory,
Limit: listLimit,
Projects: listProjects,
})
if err != nil {
return err
}
if len(results) == 0 {
fmt.Println("No workspaces found.")
if listProjects {
fmt.Println("No projects found.")
} else {
fmt.Println("No tasks found.")
}
return nil
}