From 54ef3955579efe7636514713c75b8886a748e4eb Mon Sep 17 00:00:00 2001 From: Adam Reese Date: Fri, 9 Aug 2019 13:04:18 -0700 Subject: [PATCH] ref(cmd/helm): remove helm home command This command only displays documentation. I think we should remove it in favor of documentation and add a command later if required. Signed-off-by: Adam Reese --- cmd/helm/path.go | 79 ------------------------------------------------ cmd/helm/root.go | 1 - 2 files changed, 80 deletions(-) delete mode 100644 cmd/helm/path.go diff --git a/cmd/helm/path.go b/cmd/helm/path.go deleted file mode 100644 index 92987fe9d..000000000 --- a/cmd/helm/path.go +++ /dev/null @@ -1,79 +0,0 @@ -/* -Copyright The Helm Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package main - -import ( - "fmt" - "io" - - "github.com/spf13/cobra" - - "helm.sh/helm/cmd/helm/require" - "helm.sh/helm/pkg/helmpath" -) - -var longPathHelp = ` -This command displays the locations where Helm stores files. - -To display a specific location, use 'helm path [config|data|cache]'. -` - -var pathArgMap = map[string]string{ - "config": helmpath.ConfigPath(), - "data": helmpath.DataPath(), - "cache": helmpath.CachePath(), -} - -func newPathCmd(out io.Writer) *cobra.Command { - cmd := &cobra.Command{ - Use: "path", - Short: "displays the locations where Helm stores files", - Aliases: []string{"home"}, - Long: longPathHelp, - Args: require.MinimumNArgs(0), - RunE: func(cmd *cobra.Command, args []string) error { - if len(args) > 0 { - if p, ok := pathArgMap[args[0]]; ok { - fmt.Fprintln(out, p) - } else { - var validArgs []string - for arg := range pathArgMap { - validArgs = append(validArgs, arg) - } - return fmt.Errorf("invalid argument '%s'. Must be one of: %s", args[0], validArgs) - } - } else { - // NOTE(bacongobbler): the order here is important: we want to display the config path - // first so users can parse the first line to replicate Helm 2's `helm home`. - fmt.Fprintln(out, helmpath.ConfigPath()) - fmt.Fprintln(out, helmpath.DataPath()) - fmt.Fprintln(out, helmpath.CachePath()) - if settings.Debug { - fmt.Fprintf(out, "Archive: %s\n", helmpath.Archive()) - fmt.Fprintf(out, "PluginCache: %s\n", helmpath.PluginCache()) - fmt.Fprintf(out, "Plugins: %s\n", helmpath.Plugins()) - fmt.Fprintf(out, "Registry: %s\n", helmpath.Registry()) - fmt.Fprintf(out, "RepositoryCache: %s\n", helmpath.RepositoryCache()) - fmt.Fprintf(out, "RepositoryFile: %s\n", helmpath.RepositoryFile()) - fmt.Fprintf(out, "Starters: %s\n", helmpath.Starters()) - } - } - return nil - }, - } - return cmd -} diff --git a/cmd/helm/root.go b/cmd/helm/root.go index fe336057a..f8d91e764 100644 --- a/cmd/helm/root.go +++ b/cmd/helm/root.go @@ -185,7 +185,6 @@ func newRootCmd(actionConfig *action.Configuration, out io.Writer, args []string newUpgradeCmd(actionConfig, out), newCompletionCmd(out), - newPathCmd(out), newInitCmd(out), newPluginCmd(out), newVersionCmd(out),