cli: show ? lists the views instead of calling the key an invalid command #1679

Merged
jaylouisw merged 2 commits from fix/1116-1435 into main 2026-11-16 15:16:37 +00:00
Owner

Fixes #1673

At the view-word position — the second of the two places this console keeps a complete table (the note over EXEC_WORDS) — ? was answered as a typo, while one word deeper the same question had always been answered in full:

Router# show ?
% Invalid show command: ?
Router# show ip ?
% `show ip` needs a view. This console has: route, interface brief, ospf, ...

What changed (engine/cli.js)

  • show ? (and sh ?) answers from SHOW_VIEW_WORDS, the table the dispatcher resolves sh ver against, so the list cannot advertise a view that show then refuses.
  • Every row is a completion of show , so the list is pasteable the way the views it lists are: mac and power are printed with the word they need (address-table, inline), because bare they are refused.
  • Aliases are named beside the words they reach: ver = version, interface = interfaces, run = running-config, port-channel = etherchannel, access-list = access-lists.
  • ip and ipv6 take a view of their own and get their own line. show ipv6 ? now answers with its one view, nd, where it was the same invalid-command report.
  • Nothing else moves: an unknown word is still an unknown word, an ambiguous prefix is still refused, and interface ? / speed ? are still left alone — there is no complete table there, so the console does not guess.

Tests — test/help-key-works-in-every-prompt.test.js gained a tenth test that pins every printed row, every alias, both ip doors, and types each printed form back. Reproduce first, then fix: the assertion failed with % Invalid show command: ? before the change.

Gates — npm test 281 suites / 10,064 assertions / 0 failed; syntax 352 files OK; control bytes clean; canonical URLs 2,835 files; node surface clean; missing-devices examples CI gate passed; check-doc-citations 0 suspects (three citations shifted by this diff refreshed to the lines the code is on; docs/CLI.md documents the new answer).

Fixes #1673 At the view-word position — the second of the two places this console keeps a *complete* table (the note over `EXEC_WORDS`) — `?` was answered as a typo, while one word deeper the same question had always been answered in full: ``` Router# show ? % Invalid show command: ? Router# show ip ? % `show ip` needs a view. This console has: route, interface brief, ospf, ... ``` **What changed** (`engine/cli.js`) - `show ?` (and `sh ?`) answers from `SHOW_VIEW_WORDS`, the table the dispatcher resolves `sh ver` against, so the list cannot advertise a view that `show` then refuses. - Every row is a *completion of `show `*, so the list is pasteable the way the views it lists are: `mac` and `power` are printed with the word they need (`address-table`, `inline`), because bare they are refused. - Aliases are named beside the words they reach: `ver = version`, `interface = interfaces`, `run = running-config`, `port-channel = etherchannel`, `access-list = access-lists`. - `ip` and `ipv6` take a view of their own and get their own line. `show ipv6 ?` now answers with its one view, `nd`, where it was the same invalid-command report. - Nothing else moves: an unknown word is still an unknown word, an ambiguous prefix is still refused, and `interface ?` / `speed ?` are still left alone — there is no complete table there, so the console does not guess. **Tests** — `test/help-key-works-in-every-prompt.test.js` gained a tenth test that pins every printed row, every alias, both `ip` doors, and types each printed form back. Reproduce first, then fix: the assertion failed with `% Invalid show command: ?` before the change. **Gates** — `npm test` **281 suites / 10,064 assertions / 0 failed**; syntax 352 files OK; control bytes clean; canonical URLs 2,835 files; node surface clean; `missing-devices examples` CI gate passed; `check-doc-citations` 0 suspects (three citations shifted by this diff refreshed to the lines the code is on; `docs/CLI.md` documents the new answer).
cli: show ? lists the views instead of calling the key an invalid command (#1673)
All checks were successful
CI / Classify the change (pull_request) Successful in 13s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 18s
CI / Server smoke test (pull_request) Successful in 27s
CI / Docker build (pull_request) Successful in 34s
CI / Test (Node 18) (pull_request) Successful in 1m26s
CI / Test (Node 20) (pull_request) Successful in 1m34s
CI / Test (Node 22) (pull_request) Successful in 1m43s
ed48585db2
At the view-word position - the second of the two places this console keeps a
*complete* table, as the note over EXEC_WORDS says - `?` was answered as a typo:

  Router# show ?
  % Invalid show command: ?

while one word deeper the same question had always been answered in full:

  Router# show ip ?
  % `show ip` needs a view. This console has: route, interface brief, ospf, ...

So the operator unsure of the first word of a `show` line was told the key itself
was the mistake, and the one unsure of the second was handed the list. The list
is built from SHOW_VIEW_WORDS, the table the dispatcher resolves `sh ver` against,
so it cannot name a view that `show` then refuses.

Every row it prints is a completion of `show `, so the list is pasteable the way
the views it lists are: `mac` and `power` appear with the word they need
(`address-table`, `inline`) because bare they are refused, and the aliases
(`run`, `port-channel`, `interface`, `ver`, `access-list`) are named beside the
words they reach. `ip` and `ipv6` take a view of their own and get their own line;
`show ipv6 ?` now answers with its one view, `nd`, where it was the same invalid
command report.

Nothing else moves: an unknown word is still an unknown word, an ambiguous prefix
is still refused, and `interface ?` / `speed ?` are still left alone - there is no
complete table there, so the console does not guess.

test/help-key-works-in-every-prompt.test.js pins every row, every alias and both
`ip` doors, and types each printed form back. Three doc citations touched by the
shift in engine/cli.js are refreshed to the lines the code is on.
Author
Owner

This branch conflicts with main, so it was not rebased:

docs/BGP-POLICY.md docs/CLI.md engine/cli.js test/help-key-works-in-every-prompt.test.js 

A conflict is a decision about behaviour rather than a mechanical fix, so this is left for a human. Rebasing by hand and force-pushing will let the automation pick it up again.

This branch conflicts with `main`, so it was not rebased: ``` docs/BGP-POLICY.md docs/CLI.md engine/cli.js test/help-key-works-in-every-prompt.test.js ``` A conflict is a decision about behaviour rather than a mechanical fix, so this is left for a human. Rebasing by hand and force-pushing will let the automation pick it up again.
Merge origin/main into fix/1116-1435
All checks were successful
CI / Classify the change (pull_request) Successful in 16s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 15s
CI / Server smoke test (pull_request) Successful in 25s
CI / Docker build (pull_request) Successful in 50s
CI / Test (Node 18) (pull_request) Successful in 1m52s
CI / Test (Node 20) (pull_request) Successful in 1m50s
CI / Test (Node 22) (pull_request) Successful in 1m55s
07e96b8192
`docs/CLI.md` conflicted with #1676, which fixed the same converge citation in
different words. Kept main's paragraph - it also records that `help` still
advertises `converge [at <ms>]` - and recomputed both line numbers against the
merged `engine/cli.js`: `_converge()` is at 2857 and the `help` row that names
the wrong form is at 5028. `docs/BGP-POLICY.md`'s two `_help()` citations moved
4983 -> 4988 for the same reason. `check-doc-citations` reports no suspect.
jaylouisw scheduled this pull request to auto merge when all checks succeed 2026-11-16 15:16:06 +00:00
Author
Owner

This branch conflicts with main, so it was not rebased:

docs/BGP-POLICY.md docs/CLI.md engine/cli.js test/help-key-works-in-every-prompt.test.js 

A conflict is a decision about behaviour rather than a mechanical fix, so this is left for a human. Rebasing by hand and force-pushing will let the automation pick it up again.

This branch conflicts with `main`, so it was not rebased: ``` docs/BGP-POLICY.md docs/CLI.md engine/cli.js test/help-key-works-in-every-prompt.test.js ``` A conflict is a decision about behaviour rather than a mechanical fix, so this is left for a human. Rebasing by hand and force-pushing will let the automation pick it up again.
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!1679
No description provided.