feat(completion): Add support for powershell completion (#1408)
This commit is to add support for powershell completion script. Note: PowerShell v5.0+ is required
This commit is contained in:
parent
70cd9ba63b
commit
073e590a63
@ -35,6 +35,13 @@ func (e *Executor) initCompletion() {
|
|||||||
RunE: e.executeFishCompletion,
|
RunE: e.executeFishCompletion,
|
||||||
}
|
}
|
||||||
completionCmd.AddCommand(fishCmd)
|
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 {
|
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
|
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
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user