aboutsummaryrefslogtreecommitdiff
path: root/completions/powershell
diff options
context:
space:
mode:
authorPaul Holzinger <pholzing@redhat.com>2021-07-01 20:01:44 +0200
committerPaul Holzinger <pholzing@redhat.com>2021-07-02 17:49:12 +0200
commit84da70a0f36e7d6fc87919ca4a69b20bc9d43f72 (patch)
tree696da47db75d9491d1b9567334c96f915e067f8b /completions/powershell
parent924cd37a37f1c58911ce7bc10b82ec9579c5c70e (diff)
downloadpodman-84da70a0f36e7d6fc87919ca4a69b20bc9d43f72.tar.gz
podman-84da70a0f36e7d6fc87919ca4a69b20bc9d43f72.tar.bz2
podman-84da70a0f36e7d6fc87919ca4a69b20bc9d43f72.zip
update shell completion scripts
The new cobra v1.2.0 release brings a number of bug fixes for shell completion scripts. Regenerate the scripts with `make completions` to sync them with the upstream version, currently we have some custom ones to avoid some upstream bugs. Because the new cobra version has all fixes we should use the upstream scripts. Add a check to CI to ensure we always use the up to date scripts. [NO TESTS NEEDED] Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Diffstat (limited to 'completions/powershell')
-rw-r--r--completions/powershell/podman-remote.ps130
-rw-r--r--completions/powershell/podman.ps130
2 files changed, 30 insertions, 30 deletions
diff --git a/completions/powershell/podman-remote.ps1 b/completions/powershell/podman-remote.ps1
index 875684b34..e065d0426 100644
--- a/completions/powershell/podman-remote.ps1
+++ b/completions/powershell/podman-remote.ps1
@@ -123,19 +123,6 @@ Register-ArgumentCompleter -CommandName 'podman-remote' -ScriptBlock {
$Space = ""
}
- if (($Directive -band $ShellCompDirectiveNoFileComp) -ne 0 ) {
- __podman-remote_debug "ShellCompDirectiveNoFileComp is called"
-
- if ($Values.Length -eq 0) {
- # Just print an empty string here so the
- # shell does not start to complete paths.
- # We cannot use CompletionResult here because
- # it does not accept an empty string as argument.
- ""
- return
- }
- }
-
if ((($Directive -band $ShellCompDirectiveFilterFileExt) -ne 0 ) -or
(($Directive -band $ShellCompDirectiveFilterDirs) -ne 0 )) {
__podman-remote_debug "ShellCompDirectiveFilterFileExt ShellCompDirectiveFilterDirs are not supported"
@@ -148,13 +135,26 @@ Register-ArgumentCompleter -CommandName 'podman-remote' -ScriptBlock {
# filter the result
$_.Name -like "$WordToComplete*"
- # Join the flag back if we have a equal sign flag
+ # Join the flag back if we have an equal sign flag
if ( $IsEqualFlag ) {
__podman-remote_debug "Join the equal sign flag back to the completion value"
$_.Name = $Flag + "=" + $_.Name
}
}
+ if (($Directive -band $ShellCompDirectiveNoFileComp) -ne 0 ) {
+ __podman-remote_debug "ShellCompDirectiveNoFileComp is called"
+
+ if ($Values.Length -eq 0) {
+ # Just print an empty string here so the
+ # shell does not start to complete paths.
+ # We cannot use CompletionResult here because
+ # it does not accept an empty string as argument.
+ ""
+ return
+ }
+ }
+
# Get the current mode
$Mode = (Get-PSReadLineKeyHandler | Where-Object {$_.Key -eq "Tab" }).Function
__podman-remote_debug "Mode: $Mode"
@@ -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 that's not possible with TabCompleteNext
+ # Description will not be shown because thats 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 619c5beea..fa856eee4 100644
--- a/completions/powershell/podman.ps1
+++ b/completions/powershell/podman.ps1
@@ -123,19 +123,6 @@ Register-ArgumentCompleter -CommandName 'podman' -ScriptBlock {
$Space = ""
}
- if (($Directive -band $ShellCompDirectiveNoFileComp) -ne 0 ) {
- __podman_debug "ShellCompDirectiveNoFileComp is called"
-
- if ($Values.Length -eq 0) {
- # Just print an empty string here so the
- # shell does not start to complete paths.
- # We cannot use CompletionResult here because
- # it does not accept an empty string as argument.
- ""
- return
- }
- }
-
if ((($Directive -band $ShellCompDirectiveFilterFileExt) -ne 0 ) -or
(($Directive -band $ShellCompDirectiveFilterDirs) -ne 0 )) {
__podman_debug "ShellCompDirectiveFilterFileExt ShellCompDirectiveFilterDirs are not supported"
@@ -148,13 +135,26 @@ Register-ArgumentCompleter -CommandName 'podman' -ScriptBlock {
# filter the result
$_.Name -like "$WordToComplete*"
- # Join the flag back if we have a equal sign flag
+ # Join the flag back if we have an equal sign flag
if ( $IsEqualFlag ) {
__podman_debug "Join the equal sign flag back to the completion value"
$_.Name = $Flag + "=" + $_.Name
}
}
+ if (($Directive -band $ShellCompDirectiveNoFileComp) -ne 0 ) {
+ __podman_debug "ShellCompDirectiveNoFileComp is called"
+
+ if ($Values.Length -eq 0) {
+ # Just print an empty string here so the
+ # shell does not start to complete paths.
+ # We cannot use CompletionResult here because
+ # it does not accept an empty string as argument.
+ ""
+ return
+ }
+ }
+
# Get the current mode
$Mode = (Get-PSReadLineKeyHandler | Where-Object {$_.Key -eq "Tab" }).Function
__podman_debug "Mode: $Mode"
@@ -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 that's not possible with TabCompleteNext
+ # Description will not be shown because thats not possible with TabCompleteNext
[System.Management.Automation.CompletionResult]::new($($comp.Name | __podman_escapeStringWithSpecialChars), "$($comp.Name)", 'ParameterValue', "$($comp.Description)")
}
}