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

Function outputProjectTable

apps/cli/internal/cli/list.go:188–225  ·  view source on GitHub ↗
(ptasks []*ProjectTask, columnsStr string)

Source from the content-addressed store, hash-verified

186}
187
188func outputProjectTable(ptasks []*ProjectTask, columnsStr string) error {
189 if len(ptasks) == 0 {
190 fmt.Println("No tasks found")
191 return nil
192 }
193
194 columns := strings.Split(columnsStr, ",")
195 for i, col := range columns {
196 columns[i] = strings.TrimSpace(col)
197 }
198 columns = injectProjectColumn(columns)
199
200 r := getRenderer()
201 tw := NewTableWriter()
202 tw.AddHeader(columns)
203 tw.AddSeparator()
204
205 for _, pt := range ptasks {
206 plain := make([]string, len(columns))
207 colored := make([]string, len(columns))
208 for i, col := range columns {
209 if col == "project" {
210 plain[i] = pt.ProjectID
211 colored[i] = pt.ProjectID
212 } else if col == "id" {
213 plain[i] = pt.QualifiedID()
214 colored[i] = formatTaskID(pt.QualifiedID(), r)
215 } else {
216 plain[i] = getColumnValue(pt.Task, col)
217 colored[i] = colorizeColumn(pt.Task, col, r)
218 }
219 }
220 tw.AddRow(plain, colored)
221 }
222
223 tw.Flush(os.Stdout)
224 return nil
225}
226
227// applyListFiltersAndSort applies all list filters, sorting, and limit.
228func applyListFiltersAndSort(tasks []*model.Task) ([]*model.Task, error) {

Callers 1

runListAllProjectsFunction · 0.85

Calls 11

AddHeaderMethod · 0.95
AddSeparatorMethod · 0.95
AddRowMethod · 0.95
FlushMethod · 0.95
injectProjectColumnFunction · 0.85
getRendererFunction · 0.85
NewTableWriterFunction · 0.85
formatTaskIDFunction · 0.85
getColumnValueFunction · 0.85
colorizeColumnFunction · 0.85
QualifiedIDMethod · 0.80

Tested by

no test coverage detected