File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change
1
+ Make velero completion zsh command output can be used by `source` command.
Original file line number Diff line number Diff line change @@ -66,7 +66,15 @@ $ velero completion fish > ~/.config/fish/completions/velero.fish
66
66
case "bash" :
67
67
cmd .Root ().GenBashCompletion (os .Stdout )
68
68
case "zsh" :
69
- cmd .Root ().GenZshCompletion (os .Stdout )
69
+ // # fix #4912
70
+ // cobra does not support zsh completion ouptput used by source command
71
+ // according to https://github.com/spf13/cobra/issues/1529
72
+ // Need to append compdef manually to do that.
73
+ zshHead := "#compdef velero\n compdef _velero velero\n "
74
+ out := os .Stdout
75
+ out .Write ([]byte (zshHead ))
76
+
77
+ cmd .Root ().GenZshCompletion (out )
70
78
case "fish" :
71
79
cmd .Root ().GenFishCompletion (os .Stdout , true )
72
80
default :
You can’t perform that action at this time.
0 commit comments