Skip to content
Myr

powershell completion fix no file comp directive (#1363)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Make sure to filter the returned completions before we check if there are valid completions left. Fixes #1362

authored by Paul Holzinger · committed by GitHub · parent 06e4b59 · Browse files · 1 file+13 added−13 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Signed-off-by: Paul Holzinger <paul.holzinger@web.de>

Diff stats

1 file+13 added−13 removed

  • other:+13 added−13 removed

1 file+13 added−13 removed

modified:powershell_completions.go+13 added-13 removed
138 unmodified lines
139 __%[1]s_debug "ShellCompDirectiveNoSpace is called"140 $Space = ""141 }142143 if (($Directive -band $ShellCompDirectiveNoFileComp) -ne 0 ) {144 __%[1]s_debug "ShellCompDirectiveNoFileComp is called"145146 if ($Values.Length -eq 0) {147 # Just print an empty string here so the148 # shell does not start to complete paths.149 # We cannot use CompletionResult here because150 # it does not accept an empty string as argument.151 ""152 return153 }154 }155143 if ((($Directive -band $ShellCompDirectiveFilterFileExt) -ne 0 ) -or144 (($Directive -band $ShellCompDirectiveFilterDirs) -ne 0 )) {145 __%[1]s_debug "ShellCompDirectiveFilterFileExt ShellCompDirectiveFilterDirs are not supported"146
11 unmodified lines
158 $_.Name = $Flag + "=" + $_.Name159 }160 }161162 if (($Directive -band $ShellCompDirectiveNoFileComp) -ne 0 ) {163 __%[1]s_debug "ShellCompDirectiveNoFileComp is called"164165 if ($Values.Length -eq 0) {166 # Just print an empty string here so the167 # shell does not start to complete paths.168 # We cannot use CompletionResult here because169 # it does not accept an empty string as argument.170 ""171 return172 }173 }174175 # Get the current mode176 $Mode = (Get-PSReadLineKeyHandler | Where-Object {$_.Key -eq "Tab" }).Function177 __%[1]s_debug "Mode: $Mode"178
107 unmodified lines