From 7ec494405ee7b8bc0e3c6ef4349927d49d087069 Mon Sep 17 00:00:00 2001 From: Casey Barton Date: Wed, 18 Oct 2023 13:02:25 -0400 Subject: [PATCH] Powershell completion alias handling --- powershell_completions.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/powershell_completions.go b/powershell_completions.go index 551951939..a0a4b4426 100644 --- a/powershell_completions.go +++ b/powershell_completions.go @@ -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)))