mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-07-31 04:22:44 +00:00
Make velero completion zsh command output can be used by source command.
Signed-off-by: Xun Jiang <jxun@vmware.com>
This commit is contained in:
@@ -0,0 +1 @@
|
||||
Make velero completion zsh command output can be used by `source` command.
|
||||
@@ -66,7 +66,15 @@ $ velero completion fish > ~/.config/fish/completions/velero.fish
|
||||
case "bash":
|
||||
cmd.Root().GenBashCompletion(os.Stdout)
|
||||
case "zsh":
|
||||
cmd.Root().GenZshCompletion(os.Stdout)
|
||||
// # fix #4912
|
||||
// cobra does not support zsh completion ouptput used by source command
|
||||
// according to https://github.com/spf13/cobra/issues/1529
|
||||
// Need to append compdef manually to do that.
|
||||
zshHead := "#compdef velero\ncompdef _velero velero\n"
|
||||
out := os.Stdout
|
||||
out.Write([]byte(zshHead))
|
||||
|
||||
cmd.Root().GenZshCompletion(out)
|
||||
case "fish":
|
||||
cmd.Root().GenFishCompletion(os.Stdout, true)
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user