diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-12-16 20:21:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-16 20:21:51 +0100 |
commit | 2c98694559b6413ec4f9abdb6d3750b6dd46cc4f (patch) | |
tree | 8bc07d671616bc402c7062cda29d0d4c6c292009 /completions/bash | |
parent | be6f9ce92186bca7cce2a0b89f82cb7c7e720029 (diff) | |
parent | 03a3fc37fe82800113a1c9043448acb2afa539a6 (diff) | |
download | podman-2c98694559b6413ec4f9abdb6d3750b6dd46cc4f.tar.gz podman-2c98694559b6413ec4f9abdb6d3750b6dd46cc4f.tar.bz2 podman-2c98694559b6413ec4f9abdb6d3750b6dd46cc4f.zip |
Merge pull request #12608 from Luap99/cobra
bump cobra to 1.3.0
Diffstat (limited to 'completions/bash')
-rw-r--r-- | completions/bash/podman | 31 | ||||
-rw-r--r-- | completions/bash/podman-remote | 31 |
2 files changed, 60 insertions, 2 deletions
diff --git a/completions/bash/podman b/completions/bash/podman index dcac09db5..c7171a9cc 100644 --- a/completions/bash/podman +++ b/completions/bash/podman @@ -116,13 +116,42 @@ __podman_process_completion_results() { _filedir -d fi else - __podman_handle_standard_completion_case + __podman_handle_completion_types fi __podman_handle_special_char "$cur" : __podman_handle_special_char "$cur" = } +__podman_handle_completion_types() { + __podman_debug "__podman_handle_completion_types: COMP_TYPE is $COMP_TYPE" + + case $COMP_TYPE in + 37|42) + # Type: menu-complete/menu-complete-backward and insert-completions + # If the user requested inserting one completion at a time, or all + # completions at once on the command-line we must remove the descriptions. + # https://github.com/spf13/cobra/issues/1508 + local tab comp + tab=$(printf '\t') + while IFS='' read -r comp; do + # Strip any description + comp=${comp%%$tab*} + # Only consider the completions that match + comp=$(compgen -W "$comp" -- "$cur") + if [ -n "$comp" ]; then + COMPREPLY+=("$comp") + fi + done < <(printf "%s\n" "${out[@]}") + ;; + + *) + # Type: complete (normal completion) + __podman_handle_standard_completion_case + ;; + esac +} + __podman_handle_standard_completion_case() { local tab comp tab=$(printf '\t') diff --git a/completions/bash/podman-remote b/completions/bash/podman-remote index 7bd10abb2..b5150e208 100644 --- a/completions/bash/podman-remote +++ b/completions/bash/podman-remote @@ -116,13 +116,42 @@ __podman-remote_process_completion_results() { _filedir -d fi else - __podman-remote_handle_standard_completion_case + __podman-remote_handle_completion_types fi __podman-remote_handle_special_char "$cur" : __podman-remote_handle_special_char "$cur" = } +__podman-remote_handle_completion_types() { + __podman-remote_debug "__podman-remote_handle_completion_types: COMP_TYPE is $COMP_TYPE" + + case $COMP_TYPE in + 37|42) + # Type: menu-complete/menu-complete-backward and insert-completions + # If the user requested inserting one completion at a time, or all + # completions at once on the command-line we must remove the descriptions. + # https://github.com/spf13/cobra/issues/1508 + local tab comp + tab=$(printf '\t') + while IFS='' read -r comp; do + # Strip any description + comp=${comp%%$tab*} + # Only consider the completions that match + comp=$(compgen -W "$comp" -- "$cur") + if [ -n "$comp" ]; then + COMPREPLY+=("$comp") + fi + done < <(printf "%s\n" "${out[@]}") + ;; + + *) + # Type: complete (normal completion) + __podman-remote_handle_standard_completion_case + ;; + esac +} + __podman-remote_handle_standard_completion_case() { local tab comp tab=$(printf '\t') |