Skip to content

cli: add --narrow option to user list#3589

Merged
juan-malbeclabs merged 1 commit intomainfrom
cli-narrow-user-list
Apr 25, 2026
Merged

cli: add --narrow option to user list#3589
juan-malbeclabs merged 1 commit intomainfrom
cli-narrow-user-list

Conversation

@ben-dz
Copy link
Copy Markdown
Contributor

@ben-dz ben-dz commented Apr 24, 2026

Summary of Changes

  • Add --narrow flag to doublezero user list that produces a terminal-friendly table by dropping location, cyoa_type, accesspass, and tunnel_net, abbreviating user_type (e.g. IBRLWithAllocatedIPIBRL+IP), and summarizing groups as one P: entry and one S: entry, each followed by +N for remaining groups of that role.
  • Leave the default (non-narrow) table and JSON output unchanged — no changes to column set, column widths, or string formatting on the existing paths.
  • Narrow rows fit under a 240-column budget for typical mainnet data; a render-level test enforces that cap on every line of narrow output.

Diff Breakdown

Category Files Lines (+/-) Net
Core logic 1 +105 / -0 +105
Tests 1 +115 / -0 +115
Docs 1 +3 / -0 +3
Total 2 +223 / -0 +223

Change is additive only: one new CLI flag plus a dedicated narrow-render struct and helpers, alongside direct unit tests for the group summarizer and an end-to-end --narrow execution test.

Key files (click to expand)
  • smartcontract/cli/src/user/list.rs — adds --narrow arg, UserDisplayNarrow (11-column Tabled struct), abbreviate_name / abbreviate_user_type / narrow_groups / narrow_role_entry helpers, new unit test for narrow_groups, and a --narrow case in test_cli_user_list that also asserts every rendered row fits in 240 columns.
  • CHANGELOG.md — entry under UnreleasedChangesCLI describing the new flag and confirming default output is unchanged.

Testing Verification

  • cargo test -p doublezero_cli --lib user::list:: passes (13 tests), including the new narrow_groups unit test (empty, single-role, overflow, dual-role with independent +N) and the --narrow execution test that checks header membership, hidden columns, and the 240-col row cap.
  • cargo clippy -p doublezero_cli --all-targets -- -Dclippy::all -Dwarnings is clean.
  • cargo +nightly fmt -p doublezero_cli --check is clean.
  • Manually verified the mainnet widest-row sample (6 subscriber groups, Prepaid MAX accesspass) renders as ~238 chars in narrow mode with S:edge..reds+5 in the groups column.

@ben-dz ben-dz marked this pull request as draft April 24, 2026 22:24
… flag

Reduce the width of `doublezero user list` table output:
- Abbreviate UserType display: IBRLWithAllocatedIP → IBRL+IP, EdgeFiltering → EdgeFilt
- Abbreviate AccessPass display: SolanaValidator → SolVal, SolanaRPC → SolRPC, "expires epoch" → "exp epoch"
- Abbreviate multicast group names longer than 10 chars to first4..last4 format
- Add --narrow flag that hides groups, location, cyoa_type, accesspass, and tunnel_net columns
@ben-dz ben-dz force-pushed the cli-narrow-user-list branch from a1d4396 to 02293cb Compare April 25, 2026 00:03
@ben-dz ben-dz changed the title cli: abbreviate user list table columns and add --narrow flag cli: add --narrow option to user list Apr 25, 2026
@ben-dz ben-dz requested a review from juan-malbeclabs April 25, 2026 00:05
@ben-dz ben-dz marked this pull request as ready for review April 25, 2026 00:06
@juan-malbeclabs juan-malbeclabs merged commit 2e6577e into main Apr 25, 2026
36 checks passed
@juan-malbeclabs juan-malbeclabs deleted the cli-narrow-user-list branch April 25, 2026 01:19
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.

2 participants