bash completion: generate Click 8-compatible scripts with type,value parsing#4330
Closed
anamehra wants to merge 3 commits intosonic-net:masterfrom
Closed
bash completion: generate Click 8-compatible scripts with type,value parsing#4330anamehra wants to merge 3 commits intosonic-net:masterfrom
anamehra wants to merge 3 commits intosonic-net:masterfrom
Conversation
…parsing Use a fixed template instead of Click's source() so generated scripts invoke with bash_complete, redirect stderr, and parse type,value lines to populate COMPREPLY with values only. Signed-off-by: anamehra <anamehra@cisco.com>
Signed-off-by: anamehra <anamehra@cisco.com>
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Signed-off-by: anamehra <anamehra@cisco.com>
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes: sonic-net/sonic-buildimage#25882
Use a fixed template instead of Click's source() so generated scripts invoke with bash_complete, redirect stderr, and parse type,value lines to populate COMPREPLY with values only.
What I did
SONiC routers click tab auto completion does not work in master and 202511 images
How I did it
Shell completion (Click 8.x)
https://click.palletsprojects.com/en/8.0.x/shell-completion/
There’s no section titled “bash_complete”. It’s defined by the generic rule for adding a new shell:
bash_source → “output the completion script to source” (run once, user evals/sources it).
bash_complete → “run in completion mode and output the current completions” (run on each Tab with COMP_WORDS/COMP_CWORD set).
How to verify it
On router do
show
show platform
Previous command output (if the output of a command-line utility has changed)
New command output (if the output of a command-line utility has changed)