Skip to content

Commit

Permalink
Powershell completion alias handling
Browse files Browse the repository at this point in the history
  • Loading branch information
bartoncasey authored Oct 18, 2023
1 parent 5c962a2 commit 7ec4944
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion powershell_completions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down

0 comments on commit 7ec4944

Please sign in to comment.