cli: the show vlan Ports cell wraps at 80 columns, back under Ports at column 48 #1698

Merged
jaylouisw merged 3 commits from rev/1116-1701 into main 2026-11-16 17:28:31 +00:00
Owner

Question

Where does the Ports cell of show vlan break when the list fills the line - and does it break where a real box breaks it? research/show-vlan-columns.md left this open on purpose: the vendor pages read then had their leading whitespace collapsed by extraction, so the continuation indent was not observable and a wrap would have been a guess.

Verdict: settled, and adopted

A box wraps the list at the console's 80 columns, the continuation starts back under the Ports heading (column 48), and the break carries no comma. One rule reproduces every sample: the Ports cell has 80 - 48 = 32 columns of room, entries are joined by ", ", and an entry that would overrun the window starts a new line.

Worked checks against the published tables:

  • 2960X command reference, 48 Gi1/0/x ports: Gi1/0/2, Gi1/0/3, Gi1/0/4 is 28 characters, a fourth would be 38 -> three to a line, exactly the sample's 16 groups.
  • 2950 reset procedure, 24 Fa0/x ports: Fa0/1, Fa0/2, Fa0/3, Fa0/4 is 26, a fifth would be 33 -> four to a line, exactly the sample's 6 groups.
  • Cisco lab 5.5.1 (indentation intact): continuation lines begin at column 48; a Gig0/1, Gig0/2 tail takes its own line because the previous one was full.

Sources: 2960X 15.2(6)E command reference, 2950 factory reset, Cisco lab 5.5.1 (PDF), howtonetwork 3550 transcript.

What changed

  • engine/cli.js: vlanRows() prints a row as its head plus one or more Ports lines; VLAN_TERMINAL_COLS (80), VLAN_PORTS_INDENT (48, computed from VLAN_COLUMNS) and VLAN_PORTS_WIDTH (32) are the rule.
  • test/show-vlan-ports-wrap.test.js (13 checks): the 2950 row character for character, the 2960X rhythm at three per line, the column-48 indent, the 80-column ceiling, no comma at the break, the whole list across the break, and a one-port VLAN staying on one line.
  • The three existing show vlan readers fold continuation lines into their row - a row is one or more printed lines.
  • docs/CLI.md and research/show-vlan-columns.md: the rule, the samples and what stays open.

Gates

node scripts/syntax-check.js: 355 files OK. Full npm test: 284 suites, 10,148 assertions, 0 failed.

Unresolved

  • Terminal width. This console fixes 80; a box wraps at whatever width its terminal reports (terminal width, 0 = no wrap). Modelling a per-session width is a feature, not a fidelity fix.
  • Docs contradiction noticed, not touched: the same docs/CLI.md section still says a trunk appears in every VLAN its allowed list names, which contradicts the code, the section's own table row and research/vlan-brief-trunk-ports.md (a trunk appears in no row). Left for its own change.
## Question Where does the Ports cell of `show vlan` break when the list fills the line - and does it break where a real box breaks it? `research/show-vlan-columns.md` left this open on purpose: the vendor pages read then had their leading whitespace collapsed by extraction, so the continuation indent was not observable and a wrap would have been a guess. ## Verdict: settled, and adopted A box wraps the list at the console's 80 columns, the continuation starts back under the `Ports` heading (column 48), and the break carries no comma. One rule reproduces every sample: the Ports cell has 80 - 48 = 32 columns of room, entries are joined by `", "`, and an entry that would overrun the window starts a new line. Worked checks against the published tables: * 2960X command reference, 48 `Gi1/0/x` ports: `Gi1/0/2, Gi1/0/3, Gi1/0/4` is 28 characters, a fourth would be 38 -> **three to a line**, exactly the sample's 16 groups. * 2950 reset procedure, 24 `Fa0/x` ports: `Fa0/1, Fa0/2, Fa0/3, Fa0/4` is 26, a fifth would be 33 -> **four to a line**, exactly the sample's 6 groups. * Cisco lab 5.5.1 (indentation intact): continuation lines begin at column 48; a `Gig0/1, Gig0/2` tail takes its own line because the previous one was full. Sources: [2960X 15.2(6)E command reference](https://www.cisco.com/c/en/us/td/docs/switches/lan/catalyst2960x/software/15_2_6_e/command_reference/b_1526_2960x_cr/vlan_commands.html), [2950 factory reset](https://www.cisco.com/c/en/us/support/docs/lan-switching/vlan/217969-reset-catalyst-switches-to-factory-defau.html), [Cisco lab 5.5.1 (PDF)](https://is.muni.cz/el/1433/jaro2014/PV234/cviceni/ESwitching/ESwitching_Lab_5_5_1.pdf), [howtonetwork 3550 transcript](https://www.howtonetwork.com/certifications/cisco-2/show-vlan/). ## What changed * `engine/cli.js`: `vlanRows()` prints a row as its head plus one or more Ports lines; `VLAN_TERMINAL_COLS` (80), `VLAN_PORTS_INDENT` (48, computed from `VLAN_COLUMNS`) and `VLAN_PORTS_WIDTH` (32) are the rule. * `test/show-vlan-ports-wrap.test.js` (13 checks): the 2950 row character for character, the 2960X rhythm at three per line, the column-48 indent, the 80-column ceiling, no comma at the break, the whole list across the break, and a one-port VLAN staying on one line. * The three existing `show vlan` readers fold continuation lines into their row - a row is one or more printed lines. * `docs/CLI.md` and `research/show-vlan-columns.md`: the rule, the samples and what stays open. ## Gates `node scripts/syntax-check.js`: 355 files OK. Full `npm test`: **284 suites, 10,148 assertions, 0 failed**. ## Unresolved * **Terminal width.** This console fixes 80; a box wraps at whatever width its terminal reports (`terminal width`, 0 = no wrap). Modelling a per-session width is a feature, not a fidelity fix. * **Docs contradiction noticed, not touched:** the same `docs/CLI.md` section still says a trunk appears in every VLAN its allowed list names, which contradicts the code, the section's own table row and `research/vlan-brief-trunk-ports.md` (a trunk appears in no row). Left for its own change.
cli: the show vlan Ports cell wraps at 80 columns, back under Ports at column 48
All checks were successful
CI / Classify the change (pull_request) Successful in 12s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 17s
CI / Server smoke test (pull_request) Successful in 16s
CI / Docker build (pull_request) Successful in 25s
CI / Test (Node 20) (pull_request) Successful in 56s
CI / Test (Node 18) (pull_request) Successful in 1m2s
CI / Test (Node 22) (pull_request) Successful in 1m1s
5c16a2a9ff
A Ports list that fills the console now continues on the next line, indented to the Ports column, with no
comma at the break - the shape three published samples print. One rule reproduces all of them: 80 - 48 = 32
columns of room, entries joined by ", ", and an entry that would overrun the window starts a new line.

Worked check: 24 Fa0/x ports four to a line (26 characters, a fifth would be 33), 48 Gi1/0/x ports three to a
line (28 characters, a fourth would be 38) - the vendor tables' own groupings, not a per-family port count.

research/show-vlan-columns.md had left this open for want of a transcript with the indent intact; the 2950
reset procedure, the 2960X command reference and Cisco lab 5.5.1 settle it.

test/show-vlan-ports-wrap.test.js (13 checks) pins the wrapped shape, the 80-column ceiling, the absent
comma and the whole list across the break. The three existing show-vlan readers now fold continuation lines
into their row: a row is one or more printed lines.
jaylouisw scheduled this pull request to auto merge when all checks succeed 2026-11-16 17:28:24 +00:00
jaylouisw force-pushed rev/1116-1701 from 5c16a2a9ff
All checks were successful
CI / Classify the change (pull_request) Successful in 12s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 17s
CI / Server smoke test (pull_request) Successful in 16s
CI / Docker build (pull_request) Successful in 25s
CI / Test (Node 20) (pull_request) Successful in 56s
CI / Test (Node 18) (pull_request) Successful in 1m2s
CI / Test (Node 22) (pull_request) Successful in 1m1s
to 4bb7d7799d
All checks were successful
CI / Classify the change (pull_request) Successful in 14s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 12s
CI / Test (Node 18) (pull_request) Has been skipped
CI / Test (Node 20) (pull_request) Has been skipped
CI / Test (Node 22) (pull_request) Has been skipped
CI / Server smoke test (pull_request) Has been skipped
CI / Docker build (pull_request) Has been skipped
2026-11-16 17:28:28 +00:00
Compare
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jaylouisw/packetforge!1698
No description provided.