---------- pretty printers ---------- printTaskMetadata writes the human-readable view of a task row.
(db *sql.DB, t *flowdb.Task, root string)
| 212 | |
| 213 | // printTaskMetadata writes the human-readable view of a task row. |
| 214 | func printTaskMetadata(db *sql.DB, t *flowdb.Task, root string) { |
| 215 | archivedMarker := "" |
| 216 | if t.ArchivedAt.Valid { |
| 217 | archivedMarker = " (archived)" |
| 218 | } |
| 219 | fmt.Printf("slug: %s%s\n", t.Slug, archivedMarker) |
| 220 | fmt.Printf("name: %s\n", t.Name) |
| 221 | projName := "(floating)" |
| 222 | if t.ProjectSlug.Valid && t.ProjectSlug.String != "" { |
| 223 | projName = t.ProjectSlug.String |
| 224 | } |
| 225 | fmt.Printf("project: %s\n", projName) |
| 226 | fmt.Printf("status: %s\n", t.Status) |
| 227 | |
| 228 | // Staleness marker for in-progress tasks. |
| 229 | if t.Status == "in-progress" && !t.ArchivedAt.Valid { |
| 230 | if days, stale := taskStaleness(t, root); stale { |
| 231 | fmt.Printf(" ⚠ stale (%d days)\n", days) |
| 232 | } |
| 233 | } |
| 234 | |
| 235 | fmt.Printf("priority: %s\n", t.Priority) |
| 236 | |
| 237 | // Due date. |
| 238 | if t.DueDate.Valid && t.DueDate.String != "" { |
| 239 | dueLabel := t.DueDate.String |
| 240 | if dueInfo := formatDueDateInfo(t.DueDate.String, time.Now()); dueInfo != "" { |
| 241 | dueLabel += " " + dueInfo |
| 242 | } |
| 243 | fmt.Printf("due: %s\n", dueLabel) |
| 244 | } |
| 245 | |
| 246 | // Temporal summary: days in current status + due-date proximity. |
| 247 | if !t.ArchivedAt.Valid { |
| 248 | if summary := temporalSummary(t, time.Now()); summary != "" { |
| 249 | fmt.Printf("temporal: %s\n", summary) |
| 250 | } |
| 251 | } |
| 252 | |
| 253 | // Work dir + optional workdir registry annotation. |
| 254 | wdLine := t.WorkDir |
| 255 | if wd, err := flowdb.GetWorkdir(db, t.WorkDir); err == nil { |
| 256 | var parts []string |
| 257 | if wd.Name.Valid && wd.Name.String != "" { |
| 258 | parts = append(parts, "known: "+wd.Name.String) |
| 259 | } else { |
| 260 | parts = append(parts, "known") |
| 261 | } |
| 262 | if wd.GitRemote.Valid && wd.GitRemote.String != "" { |
| 263 | parts = append(parts, "origin: "+wd.GitRemote.String) |
| 264 | } |
| 265 | wdLine = fmt.Sprintf("%s [%s]", t.WorkDir, strings.Join(parts, ", ")) |
| 266 | } |
| 267 | fmt.Printf("work_dir: %s\n", wdLine) |
| 268 | |
| 269 | if t.WaitingOn.Valid && t.WaitingOn.String != "" { |
| 270 | fmt.Printf("waiting_on: %s\n", t.WaitingOn.String) |
| 271 | } |
no test coverage detected