cli(show): a refusal's advice must not point at a second refusal (#2146) #2151

Closed
jaylouisw wants to merge 1 commit from fix/1119-1232 into main
Owner

Fixes #2146

1. show ip interface brief <word> offered the rejected word back as a port.

r1#show ip interface brief ZZZNOPE
% ... - use `show interfaces ZZZNOPE` for one port   <- a second refusal

The pointer now prints the port only when the typed words resolve to one show interfaces can describe (same resolvePortName table, and a console/aux socket is a line, not an interface); otherwise it keeps the <port> placeholder show mac address-table interface <port> already uses.

2. show ip route <prefix> pointed at a table it never printed. The refusal is one line (#1403), so "read the row for the prefix in the table below" sent the reader past the answer. It now names the command that prints the table: type show ip route and read the row for the prefix.

docs/CLI.md quotes the second message and moves with it, and now states the rule: the sentence after the dash may not name a command that refuses in turn.

Tests: new section in test/show-argument-refusal.test.js follows every pointer rather than reading it (unknown word -> placeholder, console socket -> placeholder, every port the box lists -> show interfaces answers, route refusal -> show ip route answers). 5 of its assertions fail on origin/main. Full npm test: 374 suites, 12705 assertions, 0 failed.

Fixes #2146 **1. `show ip interface brief <word>` offered the rejected word back as a port.** ``` r1#show ip interface brief ZZZNOPE % ... - use `show interfaces ZZZNOPE` for one port <- a second refusal ``` The pointer now prints the port only when the typed words resolve to one `show interfaces` can describe (same `resolvePortName` table, and a console/aux socket is a line, not an interface); otherwise it keeps the `<port>` placeholder `show mac address-table interface <port>` already uses. **2. `show ip route <prefix>` pointed at a table it never printed.** The refusal is one line (#1403), so "read the row for the prefix in the table below" sent the reader past the answer. It now names the command that prints the table: `type `show ip route` and read the row for the prefix`. `docs/CLI.md` quotes the second message and moves with it, and now states the rule: the sentence after the dash may not name a command that refuses in turn. Tests: new section in `test/show-argument-refusal.test.js` follows every pointer rather than reading it (unknown word -> placeholder, console socket -> placeholder, every port the box lists -> `show interfaces` answers, route refusal -> `show ip route` answers). 5 of its assertions fail on origin/main. Full `npm test`: 374 suites, 12705 assertions, 0 failed.
cli(show): the advice after a refusal must not point at a second refusal (#2146)
Some checks failed
CI / Classify the change (pull_request) Successful in 43s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 13s
CI / Test (Node 20) (pull_request) Failing after 1m13s
CI / Server smoke test (pull_request) Successful in 13s
CI / Test (Node 22) (pull_request) Successful in 1m16s
CI / Test (Node 18) (pull_request) Failing after 1m18s
CI / Docker build (pull_request) Successful in 23s
CI / Arm auto-merge (pull_request) Successful in 3s
5b6fc8498e
`show ip interface brief ZZZNOPE` offered the words it had just rejected back as a
port, so following it landed on `% No interface ZZZNOPE`. The pointer now names a
port only when the typed words resolve to one `show interfaces` can describe (a
console socket is a line, not an interface); otherwise it keeps the `<port>`
placeholder `show mac address-table interface <port>` prints.

`show ip route <prefix>` sent the reader to "the table below" a one-line refusal that
prints no table. It names the command that prints one instead.

docs/CLI.md quotes both and moves with them.
Author
Owner

Closing as superseded — main already contains this change, and this branch would revert the work that landed after it.

What this PR does was landed an hour earlier by #2147 (squash a2949f9d, "cli: a show refusal names a command this box can run, and no table it did not print"). Same subject, same three files, same tests: test/show-argument-refusal.test.js gains the "advice after the dash points at something that is there (#2146)" block; engine/cli.js gains resolvePortName-guarded <port> in the show ip interface brief refusal and drops "in the table below" from show ip route. The only difference I can see is the verb — this branch says "type show ip route", main says "run show ip route".

It is also stale in a way a merge would damage: the branch predates #2149 (053b3995, power-deny / 0.0 W), and its docs/CLI.md hunk puts that section back to Oper off … 12.95 W … (denied). Merging it would revert landed documentation. Hence mergeable=false — the conflict is on docs/CLI.md and engine/cli.js, both against newer main.

No content is lost: git diff origin/main 5b6fc849 shows this branch's net effect on engine/cli.js is already in main, minus the #2149 revert.

If the "type" wording is actually wanted over "run", it is a one-line PR against current main — reopen on that basis and I will merge it. Rebased-and-reopened is fine; force-pushing this branch would drop #2149 again.

**Closing as superseded — main already contains this change, and this branch would revert the work that landed after it.** What this PR does was landed an hour earlier by **#2147** (squash `a2949f9d`, "cli: a `show` refusal names a command this box can run, and no table it did not print"). Same subject, same three files, same tests: `test/show-argument-refusal.test.js` gains the "advice after the dash points at something that is there (#2146)" block; `engine/cli.js` gains `resolvePortName`-guarded `<port>` in the `show ip interface brief` refusal and drops "in the table below" from `show ip route`. The only difference I can see is the verb — this branch says "type `show ip route`", main says "run `show ip route`". It is also stale in a way a merge would damage: the branch predates **#2149** (`053b3995`, power-deny / 0.0 W), and its `docs/CLI.md` hunk puts that section *back* to `Oper off … 12.95 W … (denied)`. Merging it would revert landed documentation. Hence `mergeable=false` — the conflict is on `docs/CLI.md` and `engine/cli.js`, both against newer main. No content is lost: `git diff origin/main 5b6fc849` shows this branch's net effect on `engine/cli.js` is already in main, minus the #2149 revert. If the "type" wording is actually wanted over "run", it is a one-line PR against current main — reopen on that basis and I will merge it. Rebased-and-reopened is fine; force-pushing this branch would drop #2149 again.
jaylouisw closed this pull request 2026-11-19 12:40:58 +00:00
Some checks failed
CI / Classify the change (pull_request) Successful in 43s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 13s
CI / Test (Node 20) (pull_request) Failing after 1m13s
CI / Server smoke test (pull_request) Successful in 13s
CI / Test (Node 22) (pull_request) Successful in 1m16s
CI / Test (Node 18) (pull_request) Failing after 1m18s
CI / Docker build (pull_request) Successful in 23s
CI / Arm auto-merge (pull_request) Successful in 3s

Pull request closed

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!2151
No description provided.