Skip to content

Bug: bash show and config command auto completion does not work #25882

@anamehra

Description

@anamehra

Is it platform specific

generic

Importance or Severity

Critical

Description of the bug

When pressing tab to auto complete options in show or config command, the auto completion doe snot work.
This looks like due to new click 8 version changes.

Steps to Reproduce

on master image, show plat, it does not auto complete.
show platform doe snot show options.

Actual Behavior and Expected Behavior

tab should auto complete or show options when pressed on show or config CLIs

the following code helps:

_show_completion() {
    COMPREPLY=( $( env COMP_WORDS="${COMP_WORDS[*]}" \
                   COMP_CWORD=$COMP_CWORD \
                   _SHOW_COMPLETE=bash_complete $1 2>/dev/null | \
                   while IFS= read -r line; do
                     [[ "$line" == *,* ]] && echo "${line##*,}"
                   done ) )
    return 0
}

complete -F _show_completion -o default show;

Relevant log output

Output of show version, show techsupport

Attach files (if any)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions