Commit a98f701a authored by Adam Reese's avatar Adam Reese Committed by GitHub

Merge pull request #2553 from adamreese/fix/helm-home-stdout

fix(helm): helm home print to stdout
parents c4a4b966 985dbae2
...@@ -155,7 +155,7 @@ func newRootCmd() *cobra.Command { ...@@ -155,7 +155,7 @@ func newRootCmd() *cobra.Command {
addFlagsTLS(newVersionCmd(nil, out)), addFlagsTLS(newVersionCmd(nil, out)),
newCompletionCmd(out), newCompletionCmd(out),
newHomeCmd(), newHomeCmd(out),
newInitCmd(out), newInitCmd(out),
newPluginCmd(out), newPluginCmd(out),
......
...@@ -17,6 +17,9 @@ limitations under the License. ...@@ -17,6 +17,9 @@ limitations under the License.
package main package main
import ( import (
"fmt"
"io"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
...@@ -25,22 +28,22 @@ This command displays the location of HELM_HOME. This is where ...@@ -25,22 +28,22 @@ This command displays the location of HELM_HOME. This is where
any helm configuration files live. any helm configuration files live.
` `
func newHomeCmd() *cobra.Command { func newHomeCmd(out io.Writer) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "home", Use: "home",
Short: "displays the location of HELM_HOME", Short: "displays the location of HELM_HOME",
Long: longHomeHelp, Long: longHomeHelp,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
h := settings.Home h := settings.Home
cmd.Println(h) fmt.Fprintln(out, h)
if settings.Debug { if settings.Debug {
cmd.Printf("Repository: %s\n", h.Repository()) fmt.Fprintf(out, "Repository: %s\n", h.Repository())
cmd.Printf("RepositoryFile: %s\n", h.RepositoryFile()) fmt.Fprintf(out, "RepositoryFile: %s\n", h.RepositoryFile())
cmd.Printf("Cache: %s\n", h.Cache()) fmt.Fprintf(out, "Cache: %s\n", h.Cache())
cmd.Printf("Stable CacheIndex: %s\n", h.CacheIndex("stable")) fmt.Fprintf(out, "Stable CacheIndex: %s\n", h.CacheIndex("stable"))
cmd.Printf("Starters: %s\n", h.Starters()) fmt.Fprintf(out, "Starters: %s\n", h.Starters())
cmd.Printf("LocalRepository: %s\n", h.LocalRepository()) fmt.Fprintf(out, "LocalRepository: %s\n", h.LocalRepository())
cmd.Printf("Plugins: %s\n", h.Plugins()) fmt.Fprintf(out, "Plugins: %s\n", h.Plugins())
} }
}, },
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment