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

fix(helm): helm home print to stdout
pull/2428/merge
Adam Reese 8 years ago committed by GitHub
commit a98f701a62

@ -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.
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
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())
} }
}, },
} }

Loading…
Cancel
Save