mirror of
https://github.com/spf13/cobra
synced 2024-12-26 22:37:08 +00:00
Powershell completion alias handling
This commit is contained in:
parent
5c962a221e
commit
7ec494405e
1 changed files with 6 additions and 1 deletions
|
@ -279,7 +279,12 @@ filter __%[1]s_escapeStringWithSpecialChars {
|
|||
}
|
||||
}
|
||||
|
||||
Register-ArgumentCompleter -CommandName '%[1]s' -ScriptBlock ${__%[2]sCompleterBlock}
|
||||
# Register the completer for the command and for all aliases of the command
|
||||
'%[1]s', (Get-Alias -Definition '%[1]s' -ErrorAction Ignore).Name | ForEach-Object {
|
||||
if ($_) {
|
||||
Register-ArgumentCompleter -CommandName $_ -ScriptBlock ${__%[2]sCompleterBlock}
|
||||
}
|
||||
}
|
||||
`, name, nameForVar, compCmd,
|
||||
ShellCompDirectiveError, ShellCompDirectiveNoSpace, ShellCompDirectiveNoFileComp,
|
||||
ShellCompDirectiveFilterFileExt, ShellCompDirectiveFilterDirs, ShellCompDirectiveKeepOrder, activeHelpEnvVar(name)))
|
||||
|
|
Loading…
Reference in a new issue