summaryrefslogtreecommitdiff
path: root/vendor/github.com/spf13/cobra/bash_completionsV2.go
diff options
context:
space:
mode:
authorPaul Holzinger <pholzing@redhat.com>2021-12-15 15:18:02 +0100
committerPaul Holzinger <pholzing@redhat.com>2021-12-16 15:28:39 +0100
commit03a3fc37fe82800113a1c9043448acb2afa539a6 (patch)
tree216aae69ad45e33c18bd5af8eb37d8a16dae4050 /vendor/github.com/spf13/cobra/bash_completionsV2.go
parentd1c91c128ea32dae3e9c56c657ea57dfed9f6ad4 (diff)
downloadpodman-03a3fc37fe82800113a1c9043448acb2afa539a6.tar.gz
podman-03a3fc37fe82800113a1c9043448acb2afa539a6.tar.bz2
podman-03a3fc37fe82800113a1c9043448acb2afa539a6.zip
bump cobra to 1.3.0
This contains some fixes for the shell completion files. [NO NEW TESTS NEEDED] Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Diffstat (limited to 'vendor/github.com/spf13/cobra/bash_completionsV2.go')
-rw-r--r--vendor/github.com/spf13/cobra/bash_completionsV2.go31
1 files changed, 30 insertions, 1 deletions
diff --git a/vendor/github.com/spf13/cobra/bash_completionsV2.go b/vendor/github.com/spf13/cobra/bash_completionsV2.go
index 8859b57c4..82d26c175 100644
--- a/vendor/github.com/spf13/cobra/bash_completionsV2.go
+++ b/vendor/github.com/spf13/cobra/bash_completionsV2.go
@@ -138,13 +138,42 @@ __%[1]s_process_completion_results() {
_filedir -d
fi
else
- __%[1]s_handle_standard_completion_case
+ __%[1]s_handle_completion_types
fi
__%[1]s_handle_special_char "$cur" :
__%[1]s_handle_special_char "$cur" =
}
+__%[1]s_handle_completion_types() {
+ __%[1]s_debug "__%[1]s_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)
+ __%[1]s_handle_standard_completion_case
+ ;;
+ esac
+}
+
__%[1]s_handle_standard_completion_case() {
local tab comp
tab=$(printf '\t')