diff --git a/pkg/commands/completion.go b/pkg/commands/completion.go index 9eb5d7d07a7c..e2be6f292929 100644 --- a/pkg/commands/completion.go +++ b/pkg/commands/completion.go @@ -35,6 +35,13 @@ func (e *Executor) initCompletion() { RunE: e.executeFishCompletion, } completionCmd.AddCommand(fishCmd) + + powerShell := &cobra.Command{ + Use: "powershell", + Short: "Output powershell completion script", + RunE: e.executePowerShellCompletion, + } + completionCmd.AddCommand(powerShell) } func (e *Executor) executeBashCompletion(cmd *cobra.Command, args []string) error { @@ -67,3 +74,12 @@ func (e *Executor) executeFishCompletion(cmd *cobra.Command, args []string) erro return nil } + +func (e *Executor) executePowerShellCompletion(cmd *cobra.Command, args []string) error { + err := cmd.Root().GenPowerShellCompletion(os.Stdout) + if err != nil { + return errors.Wrap(err, "generate powershell completion") + } + + return nil +}