aboutsummaryrefslogtreecommitdiff
path: root/completions
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 /completions
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 'completions')
-rw-r--r--completions/bash/podman31
-rw-r--r--completions/bash/podman-remote31
-rw-r--r--completions/powershell/podman-remote.ps16
-rw-r--r--completions/powershell/podman.ps16
-rw-r--r--completions/zsh/_podman4
-rw-r--r--completions/zsh/_podman-remote4
6 files changed, 70 insertions, 12 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')
diff --git a/completions/powershell/podman-remote.ps1 b/completions/powershell/podman-remote.ps1
index e065d0426..2edc79ffb 100644
--- a/completions/powershell/podman-remote.ps1
+++ b/completions/powershell/podman-remote.ps1
@@ -33,7 +33,7 @@ Register-ArgumentCompleter -CommandName 'podman-remote' -ScriptBlock {
if ($Command.Length -gt $CursorPosition) {
$Command=$Command.Substring(0,$CursorPosition)
}
- __podman-remote_debug "Truncated command: $Command"
+ __podman-remote_debug "Truncated command: $Command"
$ShellCompDirectiveError=1
$ShellCompDirectiveNoSpace=2
@@ -41,7 +41,7 @@ Register-ArgumentCompleter -CommandName 'podman-remote' -ScriptBlock {
$ShellCompDirectiveFilterFileExt=8
$ShellCompDirectiveFilterDirs=16
- # Prepare the command to request completions for the program.
+ # Prepare the command to request completions for the program.
# Split the command at the first space to separate the program and arguments.
$Program,$Arguments = $Command.Split(" ",2)
$RequestComp="$Program __complete $Arguments"
@@ -216,7 +216,7 @@ Register-ArgumentCompleter -CommandName 'podman-remote' -ScriptBlock {
Default {
# Like MenuComplete but we don't want to add a space here because
# the user need to press space anyway to get the completion.
- # Description will not be shown because thats not possible with TabCompleteNext
+ # Description will not be shown because that's not possible with TabCompleteNext
[System.Management.Automation.CompletionResult]::new($($comp.Name | __podman-remote_escapeStringWithSpecialChars), "$($comp.Name)", 'ParameterValue', "$($comp.Description)")
}
}
diff --git a/completions/powershell/podman.ps1 b/completions/powershell/podman.ps1
index fa856eee4..1cd89d0a0 100644
--- a/completions/powershell/podman.ps1
+++ b/completions/powershell/podman.ps1
@@ -33,7 +33,7 @@ Register-ArgumentCompleter -CommandName 'podman' -ScriptBlock {
if ($Command.Length -gt $CursorPosition) {
$Command=$Command.Substring(0,$CursorPosition)
}
- __podman_debug "Truncated command: $Command"
+ __podman_debug "Truncated command: $Command"
$ShellCompDirectiveError=1
$ShellCompDirectiveNoSpace=2
@@ -41,7 +41,7 @@ Register-ArgumentCompleter -CommandName 'podman' -ScriptBlock {
$ShellCompDirectiveFilterFileExt=8
$ShellCompDirectiveFilterDirs=16
- # Prepare the command to request completions for the program.
+ # Prepare the command to request completions for the program.
# Split the command at the first space to separate the program and arguments.
$Program,$Arguments = $Command.Split(" ",2)
$RequestComp="$Program __complete $Arguments"
@@ -216,7 +216,7 @@ Register-ArgumentCompleter -CommandName 'podman' -ScriptBlock {
Default {
# Like MenuComplete but we don't want to add a space here because
# the user need to press space anyway to get the completion.
- # Description will not be shown because thats not possible with TabCompleteNext
+ # Description will not be shown because that's not possible with TabCompleteNext
[System.Management.Automation.CompletionResult]::new($($comp.Name | __podman_escapeStringWithSpecialChars), "$($comp.Name)", 'ParameterValue', "$($comp.Description)")
}
}
diff --git a/completions/zsh/_podman b/completions/zsh/_podman
index 9bad56d9a..7c3d6faf3 100644
--- a/completions/zsh/_podman
+++ b/completions/zsh/_podman
@@ -125,7 +125,7 @@ _podman()
_arguments '*:filename:'"$filteringCmd"
elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then
# File completion for directories only
- local subDir
+ local subdir
subdir="${completions[1]}"
if [ -n "$subdir" ]; then
__podman_debug "Listing directories in $subdir"
@@ -173,7 +173,7 @@ _podman()
# don't run the completion function when being source-ed or eval-ed
if [ "$funcstack[1]" = "_podman" ]; then
- _podman
+ _podman
fi
# This file is generated with "podman completion"; see: podman-completion(1)
diff --git a/completions/zsh/_podman-remote b/completions/zsh/_podman-remote
index 5132d0e53..a2d24af25 100644
--- a/completions/zsh/_podman-remote
+++ b/completions/zsh/_podman-remote
@@ -125,7 +125,7 @@ _podman-remote()
_arguments '*:filename:'"$filteringCmd"
elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then
# File completion for directories only
- local subDir
+ local subdir
subdir="${completions[1]}"
if [ -n "$subdir" ]; then
__podman-remote_debug "Listing directories in $subdir"
@@ -173,7 +173,7 @@ _podman-remote()
# don't run the completion function when being source-ed or eval-ed
if [ "$funcstack[1]" = "_podman-remote" ]; then
- _podman-remote
+ _podman-remote
fi
# This file is generated with "podman-remote completion"; see: podman-completion(1)