Skip to content

fix(list): render rows in 'cu list list' table output - #59

Merged
timimsms merged 1 commit into
mainfrom
fix/list-list-table
Nov 18, 2026
Merged

timimsms merged 1 commit into
mainfrom
fix/list-list-table

Conversation

@timimsms

Copy link
Copy Markdown
Owner

Summary

cu list list printed an empty table because listListCmd collected clickup.List structs into []interface{} while the table branch only type-switched on map[string]interface{}, so no row matched. -o json was unaffected.

  • Collect results into a typed []clickup.List, which removes the type switch entirely and lets the compiler catch this kind of mismatch.
  • Move row building into listTableRows (package-level listRow, json+yaml tags) so it can be tested.
  • The tasks column is now filled from task_count. Before this change the field existed but was never set.
  • JSON/YAML/CSV output is unchanged: they still marshal the raw clickup.List values.
  • Regression test TestListTableRows renders through output.TableFormatter and checks there is one line per list, plus the default marker and task counts.

Live read-only check against a real space: table 9 rows, -o json 9, -o yaml 9.

Related, not changed here: on a cache hit, cu space list sends the cached []interface{} (decoded maps) straight to the formatter, skipping the spaceRow projection. Table output on a cache hit therefore shows every raw field, not the id/name/private/archived columns. This is a different bug from the type switch fixed here.

Closes #24

Checklist

  • ./scripts/ci.sh passes locally (or go test -race ./... at minimum): ran go build, go vet, go test ./... and gosec v2.28.0, all clean
  • Commit messages use conventional prefixes (feat:, fix:, docs:, chore:, ci:, test:)
  • CLI docs regenerated if command help text changed (cu docs markdown --dir docs/site/commands): N/A, help text unchanged
  • Docs updated if user-facing behavior changed: N/A

🤖 Generated with Claude Code

The table branch type-switched on map[string]interface{} while the
collected items were clickup.List structs, so every row was dropped.
Collect into []clickup.List and build rows with listTableRows so the
compiler catches this class of bug. The tasks column is now populated
from task_count. JSON/YAML/CSV output is unchanged.

Closes #24

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@timimsms
timimsms merged commit c2d8635 into main Nov 18, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

list: 'cu list list' table output renders zero rows (type switch misses clickup.List)

1 participant