diff --git a/example/cmd/_test/powershell.ps1 b/example/cmd/_test/powershell.ps1 index a4e77956..f72b5c77 100644 --- a/example/cmd/_test/powershell.ps1 +++ b/example/cmd/_test/powershell.ps1 @@ -42,6 +42,5 @@ Function _example_completer { $completions } -Register-ArgumentCompleter -Native -CommandName 'example' -ScriptBlock (Get-Item "Function:_example_completer").ScriptBlock -# Register-ArgumentCompleter -Native -CommandName 'example.exe' -ScriptBlock (Get-Item "Function:_example_completer").ScriptBlock +Register-ArgumentCompleter -Native -ScriptBlock (Get-Item "Function:_example_completer").ScriptBlock -CommandName 'example' # ,'example.exe' diff --git a/internal/shell/powershell/snippet.go b/internal/shell/powershell/snippet.go index 37171dbe..5c62cac4 100644 --- a/internal/shell/powershell/snippet.go +++ b/internal/shell/powershell/snippet.go @@ -54,13 +54,12 @@ Function _%v_completer { $completions } -Register-ArgumentCompleter -Native -CommandName '%v' -ScriptBlock (Get-Item "Function:_%v_completer").ScriptBlock -%vRegister-ArgumentCompleter -Native -CommandName '%v.exe' -ScriptBlock (Get-Item "Function:_%v_completer").ScriptBlock +Register-ArgumentCompleter -Native -ScriptBlock (Get-Item "Function:_%v_completer").ScriptBlock -CommandName '%v'%v,'%v.exe' ` // Snippet creates the powershell completion script. func Snippet(cmd *cobra.Command) string { - prefix := "# " + prefix := " # " if runtime.GOOS == "windows" { prefix = "" } @@ -71,6 +70,5 @@ func Snippet(cmd *cobra.Command) string { cmd.Name(), cmd.Name(), prefix, - cmd.Name(), cmd.Name()) }