revamp the cscli hub list output to make it human friendly#4564
Conversation
|
@buixor: There are no 'kind' label on this PR. You need a 'kind' label to generate the release automatically.
DetailsI am a bot created to help the crowdsecurity developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the BirthdayResearch/oss-governance-bot repository. |
|
@buixor: There are no area labels on this PR. You can add as many areas as you see fit.
DetailsI am a bot created to help the crowdsecurity developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the BirthdayResearch/oss-governance-bot repository. |
There was a problem hiding this comment.
Pull request overview
This PR revamps cscli hub list to be more human-friendly by defaulting to a collection-centric overview (with nesting), while keeping script-oriented outputs intact and adding status filtering and a new hub search command.
Changes:
- Reworks
cscli hub listhuman output into an overview tree (installed root collections + standalone installed items) and a compact flat table for-a. - Introduces single-word item status computation and a
--statusfilter shared byhub listand the newhub searchcommand. - Updates BATS tests to assert the new output structure and behaviors (nesting, taint display, status filtering, search output).
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/bats/20_hub.bats | Updates/expands BATS coverage for the new list/search UX, nesting, and status filtering behavior. |
| pkg/cwhub/state.go | Adds single-word status constants and ItemState.Status() used by the new CLI views/filters. |
| pkg/cwhub/item.go | Adds InstalledParents() helper to distinguish installed ancestry from index ancestry. |
| cmd/crowdsec-cli/clisupport/support.go | Changes hub dump in support bundle to list all installed items (not overview-only). |
| cmd/crowdsec-cli/cliitem/cmdremove.go | Switches to InstalledParents() for clearer parent collection reporting. |
| cmd/crowdsec-cli/clihub/utils_table.go | Implements new compact and overview table rendering (tree indentation, details column). |
| cmd/crowdsec-cli/clihub/search.go | Adds cscli hub search (term-based local index search with optional status filtering). |
| cmd/crowdsec-cli/clihub/items.go | Adds status filter helpers and installed-root/standalone selection helpers. |
| cmd/crowdsec-cli/clihub/hub.go | Wires in the new list modes, --status support, and registers the new search subcommand. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Status returns the item's state as a single mutually-exclusive word (see the Status* constants). | ||
| // Taint is only reported for installed items: it propagates to ancestor collections even when they | ||
| // are not installed themselves. | ||
| func (s *ItemState) Status() string { | ||
| switch { | ||
| case !s.IsInstalled(): | ||
| return StatusNotInstalled | ||
| case s.Tainted: | ||
| return StatusTainted | ||
| case s.IsLocal(): | ||
| return StatusLocal | ||
| case !s.UpToDate: | ||
| return StatusOutdated | ||
| default: | ||
| return StatusUpToDate | ||
| } | ||
| } |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #4564 +/- ##
==========================================
+ Coverage 63.75% 63.82% +0.07%
==========================================
Files 507 508 +1
Lines 38652 38929 +277
==========================================
+ Hits 24644 24848 +204
- Misses 11650 11714 +64
- Partials 2358 2367 +9
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
/area cscli |
Uh oh!
There was an error while loading. Please reload this page.