cli: a ? at the end of a no line removes nothing and names the syntax #1699

Merged
jaylouisw merged 4 commits from fix/1116-1706 into main 2026-11-16 17:32:29 +00:00
Owner

Fixes #1694

no reads the tokens it needs and ignores the rest, so a ? typed where the operator expected help was one more token to ignore and the line acted:

no vlan 42 name ?   ->  VLAN 42 removed
no hostname ?       ->  Hostname cleared (device is now ...)
no description ?    ->  Description removed: lab

The key is refused at the top of config, interface and DHCP pool mode - before any no branch acts, which is the only place it can be caught, because the damage is done by the tokens before the key - and the answer is written in the words of the branch it stopped:

% "?" is the help key, not a value: `no vlan <id>` removes a VLAN - nothing was removed

What is not changed, and is pinned: a ? inside a longer word is still part of the value (no vlan 42 name lab?1 runs), a bare no ? is answered as the short line it is (and points at the index), and every real no line still works.

Tests: new test/no-form-help-key.test.js (81 assertions) covering the three forms from the issue plus the sweep over the other heads that ignore trailing tokens - no spanning-tree, no access-list, no ip route, no ip nat pool, no ip address, no shutdown, and in DHCP pool mode no network and no pool (which removed the whole pool).

Gates: node scripts/syntax-check.js (355 files, all OK); full npm test - 284 suites, 10216 assertions passed, 0 failed.

Fixes #1694 `no` reads the tokens it needs and ignores the rest, so a `?` typed where the operator expected help was one more token to ignore and the line acted: ``` no vlan 42 name ? -> VLAN 42 removed no hostname ? -> Hostname cleared (device is now ...) no description ? -> Description removed: lab ``` The key is refused at the top of config, interface and DHCP pool mode - before any `no` branch acts, which is the only place it can be caught, because the damage is done by the tokens *before* the key - and the answer is written in the words of the branch it stopped: ``` % "?" is the help key, not a value: `no vlan <id>` removes a VLAN - nothing was removed ``` What is not changed, and is pinned: a `?` inside a longer word is still part of the value (`no vlan 42 name lab?1` runs), a bare `no ?` is answered as the short line it is (and points at the index), and every real `no` line still works. Tests: new test/no-form-help-key.test.js (81 assertions) covering the three forms from the issue plus the sweep over the other heads that ignore trailing tokens - `no spanning-tree`, `no access-list`, `no ip route`, `no ip nat pool`, `no ip address`, `no shutdown`, and in DHCP pool mode `no network` and `no pool` (which removed the whole pool). Gates: node scripts/syntax-check.js (355 files, all OK); full npm test - 284 suites, 10216 assertions passed, 0 failed.
cli: a ? at the end of a no line removes nothing and names the syntax (#1694)
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 19s
CI / Server smoke test (pull_request) Successful in 18s
CI / Docker build (pull_request) Successful in 31s
CI / Test (Node 20) (pull_request) Successful in 1m1s
CI / Test (Node 18) (pull_request) Successful in 1m6s
CI / Test (Node 22) (pull_request) Successful in 1m4s
ebe19947d5
`no` reads the tokens it needs and ignores the rest, so a `?` typed where the
operator expected help was one more token to ignore and the line acted:
`no vlan 42 name ?` removed VLAN 42 with a receipt that read like success,
`no hostname ?` cleared the name, and `no description ?` cleared the port.

The key is refused at the top of config, interface and DHCP pool mode, before
any `no` branch acts, and the answer is written in the words of the branch it
stopped, so it says what was wanted instead of only complaining:

  % "?" is the help key, not a value: `no vlan <id>` removes a VLAN - nothing was removed

Only a whole token is the key (`no vlan 42 name lab?1` still runs the branch),
`no ?` on its own is answered as the short line it is, and every real `no`
line is untouched. Pinned in test/no-form-help-key.test.js, including the
other heads that ignore trailing tokens: no spanning-tree, no access-list,
no ip route, no ip nat pool, no ip address, no shutdown, and no pool.
jaylouisw scheduled this pull request to auto merge when all checks succeed 2026-11-16 17:32:20 +00:00
jaylouisw force-pushed fix/1116-1706 from ebe19947d5
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 19s
CI / Server smoke test (pull_request) Successful in 18s
CI / Docker build (pull_request) Successful in 31s
CI / Test (Node 20) (pull_request) Successful in 1m1s
CI / Test (Node 18) (pull_request) Successful in 1m6s
CI / Test (Node 22) (pull_request) Successful in 1m4s
to 3bcfac72d7
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 11s
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:32:25 +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!1699
No description provided.