cli(show): a pipe starts an output modifier, and the port name ends there #2537
No reviewers
Labels
No labels
blocked-on-build
bug
device
device-request
enhancement
from-github
needs-datasheet
needs-info
needs-triage
ready-for-agent
ready-for-human
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
jaylouisw/packetforge!2537
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "rev/1124-0612"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The question
A pipe on a
showline: is what stands after it a word of the name on its left, or a filter on the answer?Verdict
A filter. IOS states the grammar as
command | {begin | include | exclude} regular-expressionand works the exampleDevice# show interfaces | include protocol(Command Reference, IOS XE 17.12.x, Catalyst 9500, Searching and Filtering Output of show and more Commands; the same section verbatim in the 9200 17.18.x and 2960-X 15.2(7)E books). So the object named before the pipe is complete at the pipe.This console read the whole rest of the line as a port name:
Change
_show()now splits the line at the first|token before any door opens, so every view parses it the same way. Four one-line answers: a known filter word is refused as an output modifier this console does not model (and names the command that prints the whole answer); any other word is refused as not an output modifier, namingbegin/include/exclude; a bare pipe (or?) is% Incomplete command:; and a pipe with no view before it asks for the view. The filter word is compared lowercased like any keyword. No filter is implemented - printing an unfiltered block under a filter would be trusted lines the box had already dropped.show running-config | include vlan, which had its own sentence for this, now answers the same way as every other view.Tests
test/show-output-filter.test.js- 50 assertions: the four answers, a spaced port name (Port 1) kept whole, the port block unchanged,?-after-pipe, case-insensitive filter word, and thatshow interfaces <port> countersis still answered as a view.test/docs-show-commands.test.js7/7 andtest/show-argument-refusal.test.js97/97 - the doc section added here is typed back by the docs sweep.|. Fixed on this branch; that suite re-run is green (7/7).Docs:
docs/CLI.md, new subsection under "A command with words it cannot use refuses them". Evidence and the open edges (glued|with no spaces,?after a pipe,section) inresearch/show-output-filter.md.show interfaces Port 1 | include packets answered '% No interface Port 1 | include packets', naming a socket nobody asked about and never mentioning the one part of the line the console had not understood. IOS's grammar is 'command | {begin | include | exclude} regular-expression', so the pipe ends the command and the object named before it is complete. Parsed once, before any view opens: every door answers the same four ways, and the filter word is compared as a keyword. No filter is modelled - an unfiltered block printed under a filter would be trusted lines the box had already dropped.no dns zoneand two IPv6 handlers #2551