MCPcopy Create free account
hub / github.com/driangle/taskmd / runList

Function runList

apps/cli/internal/cli/list.go:77–119  ·  view source on GitHub ↗
(cmd *cobra.Command, args []string)

Source from the content-addressed store, hash-verified

75}
76
77func runList(cmd *cobra.Command, args []string) error {
78 if allProjectsFlag {
79 return runListAllProjects()
80 }
81
82 flags := GetGlobalFlags()
83
84 scanDir := ResolveScanDir(args)
85 debugLog("scan directory: %s", scanDir)
86
87 // Create scanner and scan for tasks
88 taskScanner := scanner.NewScanner(scanDir, flags.Verbose, flags.IgnoreDirs)
89 result, err := taskScanner.Scan()
90 if err != nil {
91 return fmt.Errorf("scan failed: %w", err)
92 }
93
94 tasks := result.Tasks
95 debugLog("found %d task(s)", len(tasks))
96
97 makeFilePathsRelative(tasks, scanDir)
98 reportScanWarnings(result, flags)
99 warnDuplicateIDs(tasks)
100
101 debugLog("format: %s, sort: %q, filters: %v", listFormat, listSort, listFilters)
102
103 tasks, err = applyListFiltersAndSort(tasks)
104 if err != nil {
105 return err
106 }
107
108 // Output in requested format
109 switch listFormat {
110 case "json":
111 return outputJSON(tasks)
112 case "yaml":
113 return outputYAML(tasks)
114 case "table":
115 return outputTable(tasks, listColumns)
116 default:
117 return ValidateFormat(listFormat, []string{"table", "json", "yaml"})
118 }
119}
120
121func runListAllProjects() error {
122 ptasks, err := scanAllProjects()

Callers 3

captureRunListFunction · 0.85
captureListOutputFunction · 0.85

Calls 13

ScanMethod · 0.95
runListAllProjectsFunction · 0.85
GetGlobalFlagsFunction · 0.85
ResolveScanDirFunction · 0.85
debugLogFunction · 0.85
makeFilePathsRelativeFunction · 0.85
reportScanWarningsFunction · 0.85
warnDuplicateIDsFunction · 0.85
applyListFiltersAndSortFunction · 0.85
outputJSONFunction · 0.85
outputYAMLFunction · 0.85
outputTableFunction · 0.85

Tested by 3

captureRunListFunction · 0.68
captureListOutputFunction · 0.68