mirror of
https://github.com/spf13/cobra
synced 2024-12-28 23:37:09 +00:00
Update powershell_completions.go
Implement curly bracket technique like https://github.com/spf13/cobra/pull/1960
This commit is contained in:
parent
cc6f7e0edd
commit
0676e2612e
1 changed files with 2 additions and 2 deletions
|
@ -282,12 +282,12 @@ filter __%[1]s_escapeStringWithSpecialChars {
|
|||
$available%[2]s = Get-Command -Name '%[1]s' -All -ErrorAction SilentlyContinue
|
||||
|
||||
# Enumerate extant aliases for %[1]s (already set by user)
|
||||
$__%[2]sAliases = @()
|
||||
${__%[2]sAliases} = @()
|
||||
foreach($__%[2]sCmd in $available%[2]s){
|
||||
$__%[2]sAliases += Get-Alias | Where-Object { $_.Definition -eq ($__%[2]sCmd | Resolve-Path) }
|
||||
}
|
||||
# Register args completer for all cmds and aliases
|
||||
Register-ArgumentCompleter -CommandName ([array]$available%[2]s.Name + [array]$__%[2]sAliases.Name + @('%[1]s')) -ScriptBlock $__%[2]sCompleterBlock
|
||||
Register-ArgumentCompleter -CommandName ([array]$available%[2]s.Name + [array]${__%[2]sAliases}.Name + @('%[1]s')) -ScriptBlock ${__%[2]sCompleterBlock}
|
||||
`, name, nameForVar, compCmd,
|
||||
ShellCompDirectiveError, ShellCompDirectiveNoSpace, ShellCompDirectiveNoFileComp,
|
||||
ShellCompDirectiveFilterFileExt, ShellCompDirectiveFilterDirs, ShellCompDirectiveKeepOrder, activeHelpEnvVar(name)))
|
||||
|
|
Loading…
Reference in a new issue