cli: a show refusal names a command this box can run, and no table it did not print (#2146) #2147

Merged
jaylouisw merged 1 commit from fix/1119-1202 into main 2026-11-19 12:39:34 +00:00
Owner

Fixes #2146

Both refusals in _show() ended with advice about something that does not exist.

show ip interface brief <word> built its pointer from the word it had just rejected:

r1#show ip interface brief ZZZNOPE
% show ip interface brief does not take "ZZZNOPE": every interface is listed - use `show interfaces ZZZNOPE` for one port
r1#show interfaces ZZZNOPE
% No interface ZZZNOPE on ISR 4331 branch router-r1

The pointer now resolves the typed words with the same resolvePortName() the interface command uses, and carries a port only when the box has it. A word that is not a port leaves the <port> placeholder that the show mac address-table interface <port> refusal already uses, so the sentence teaches the shape of the command instead of inventing a spelling of it. show ip interface brief Gi1/0/1 still answers use show interfaces Gi1/0/1 for one port - that pointer runs and answers.

show ip route <prefix> said to read the row "in the table below", after a one-line refusal (the #1403 behaviour, unchanged) that prints no table. It now names the command that does print it:

r1#show ip route 192.0.2.0/24
% show ip route does not take "192.0.2.0/24": the whole table is printed - run `show ip route` and read the row for the prefix

docs/CLI.md quotes that line in "A command with words it cannot use refuses them", so the doc moves with it.

Tests

test/show-argument-refusal.test.js +7 assertions: the pointer for an unknown word carries no port and keeps the placeholder; the pointer for a real port names it and is then run, and its answer is not % No interface; the route refusal neither says "table below" nor fails to name show ip route.

  • node scripts/syntax-check.js - 452 files, all OK
  • test/show-argument-refusal.test.js - 84 passed, 0 failed (was 77)
  • npm test - 373 suites, 12684 assertions passed, 0 failed
Fixes #2146 Both refusals in `_show()` ended with advice about something that does not exist. **`show ip interface brief <word>`** built its pointer from the word it had just rejected: ``` r1#show ip interface brief ZZZNOPE % show ip interface brief does not take "ZZZNOPE": every interface is listed - use `show interfaces ZZZNOPE` for one port r1#show interfaces ZZZNOPE % No interface ZZZNOPE on ISR 4331 branch router-r1 ``` The pointer now resolves the typed words with the same `resolvePortName()` the `interface` command uses, and carries a port only when the box has it. A word that is not a port leaves the `<port>` placeholder that the `show mac address-table interface <port>` refusal already uses, so the sentence teaches the shape of the command instead of inventing a spelling of it. `show ip interface brief Gi1/0/1` still answers `use `show interfaces Gi1/0/1` for one port` - that pointer runs and answers. **`show ip route <prefix>`** said to read the row "in the table below", after a one-line refusal (the #1403 behaviour, unchanged) that prints no table. It now names the command that does print it: ``` r1#show ip route 192.0.2.0/24 % show ip route does not take "192.0.2.0/24": the whole table is printed - run `show ip route` and read the row for the prefix ``` `docs/CLI.md` quotes that line in "A command with words it cannot use refuses them", so the doc moves with it. ## Tests `test/show-argument-refusal.test.js` +7 assertions: the pointer for an unknown word carries no port and keeps the placeholder; the pointer for a real port names it *and is then run*, and its answer is not `% No interface`; the route refusal neither says "table below" nor fails to name `show ip route`. - `node scripts/syntax-check.js` - 452 files, all OK - `test/show-argument-refusal.test.js` - 84 passed, 0 failed (was 77) - `npm test` - 373 suites, 12684 assertions passed, 0 failed
cli: a show refusal names a command this box can run, and no table it did not print (#2146)
All checks were successful
CI / Classify the change (pull_request) Successful in 10s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 7s
CI / Test (Node 20) (pull_request) Successful in 53s
CI / Test (Node 18) (pull_request) Successful in 56s
CI / Test (Node 22) (pull_request) Successful in 51s
CI / Server smoke test (pull_request) Successful in 9s
CI / Docker build (pull_request) Successful in 18s
CI / Arm auto-merge (pull_request) Successful in 4s
f3f02d7d2f
`show ip interface brief ZZZNOPE` refused the word and then advised
`show interfaces ZZZNOPE` - a command whose own answer is `% No interface
ZZZNOPE`. The pointer now carries the typed port only when the words name one
the box has, and otherwise keeps the `<port>` placeholder the mac-address-table
refusal already uses.

`show ip route <prefix>` said to read the row "in the table below" - the
refusal is one line and nothing follows it, so it names `show ip route` instead.
docs/CLI.md quotes that line and moves with it.

test/show-argument-refusal.test.js: +7 assertions, two of them running the
command the pointer names.
forgejo-actions scheduled this pull request to auto merge when all checks succeed 2026-11-19 12:15:00 +00:00
jaylouisw deleted branch fix/1119-1202 2026-11-19 12:39:36 +00:00
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!2147
No description provided.