diff --git a/cmd/helm/helm_test.go b/cmd/helm/helm_test.go index 15bbbe045..5e59c41ed 100644 --- a/cmd/helm/helm_test.go +++ b/cmd/helm/helm_test.go @@ -120,7 +120,8 @@ func executeActionCommandStdinC(store *storage.Storage, in *os.File, cmd string) return nil, "", err } - root.SetOutput(buf) + root.SetOut(buf) + root.SetErr(buf) root.SetArgs(args) oldStdin := os.Stdin diff --git a/cmd/helm/install.go b/cmd/helm/install.go index 300d23e87..19bc43dea 100644 --- a/cmd/helm/install.go +++ b/cmd/helm/install.go @@ -17,11 +17,11 @@ limitations under the License. package main import ( - "fmt" "io" "io/ioutil" "log" "strings" + "log" "time" "github.com/pkg/errors" diff --git a/cmd/helm/upgrade.go b/cmd/helm/upgrade.go index 3da794c9d..6613c47b6 100644 --- a/cmd/helm/upgrade.go +++ b/cmd/helm/upgrade.go @@ -207,5 +207,16 @@ func newUpgradeCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { log.Fatal(err) } + err := cmd.RegisterFlagCompletionFunc("version", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + if len(args) != 2 { + return nil, cobra.ShellCompDirectiveNoFileComp + } + return compVersionFlag(args[1], toComplete) + }) + + if err != nil { + log.Fatal(err) + } + return cmd }