add "DisableFlagsInUseLine: true" for all command

Signed-off-by: Alan Zhu <zg.zhu@daocloud.io>
pull/8095/head
Alan Zhu 5 years ago
parent c2069f7e8b
commit 7f59a6a7c0

@ -31,11 +31,12 @@ The subcommands can be used to push, pull, tag, list, or remove Helm charts.
func newChartCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { func newChartCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "chart", Use: "chart",
Short: "push, pull, tag, or remove Helm charts", DisableFlagsInUseLine: true,
Long: chartHelp, Short: "push, pull, tag, or remove Helm charts",
Hidden: !FeatureGateOCI.IsEnabled(), Long: chartHelp,
PersistentPreRunE: checkOCIFeatureGate(), Hidden: !FeatureGateOCI.IsEnabled(),
PersistentPreRunE: checkOCIFeatureGate(),
} }
cmd.AddCommand( cmd.AddCommand(
newChartListCmd(cfg, out), newChartListCmd(cfg, out),

@ -37,11 +37,12 @@ func newChartExportCmd(cfg *action.Configuration, out io.Writer) *cobra.Command
client := action.NewChartExport(cfg) client := action.NewChartExport(cfg)
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "export [ref]", Use: "export [ref]",
Short: "export a chart to directory", DisableFlagsInUseLine: true,
Long: chartExportDesc, Short: "export a chart to directory",
Args: require.MinimumNArgs(1), Long: chartExportDesc,
Hidden: !FeatureGateOCI.IsEnabled(), Args: require.MinimumNArgs(1),
Hidden: !FeatureGateOCI.IsEnabled(),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
ref := args[0] ref := args[0]
return client.Run(out, ref) return client.Run(out, ref)

@ -32,11 +32,12 @@ Charts are sorted by ref name, alphabetically.
func newChartListCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { func newChartListCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
return &cobra.Command{ return &cobra.Command{
Use: "list", Use: "list",
Aliases: []string{"ls"}, DisableFlagsInUseLine: true,
Short: "list all saved charts", Aliases: []string{"ls"},
Long: chartListDesc, Short: "list all saved charts",
Hidden: !FeatureGateOCI.IsEnabled(), Long: chartListDesc,
Hidden: !FeatureGateOCI.IsEnabled(),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
return action.NewChartList(cfg).Run(out) return action.NewChartList(cfg).Run(out)
}, },

@ -33,11 +33,12 @@ This will store the chart in the local registry cache to be used later.
func newChartPullCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { func newChartPullCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
return &cobra.Command{ return &cobra.Command{
Use: "pull [ref]", Use: "pull [ref]",
Short: "pull a chart from remote", DisableFlagsInUseLine: true,
Long: chartPullDesc, Short: "pull a chart from remote",
Args: require.MinimumNArgs(1), Long: chartPullDesc,
Hidden: !FeatureGateOCI.IsEnabled(), Args: require.MinimumNArgs(1),
Hidden: !FeatureGateOCI.IsEnabled(),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
ref := args[0] ref := args[0]
return action.NewChartPull(cfg).Run(out, ref) return action.NewChartPull(cfg).Run(out, ref)

@ -35,11 +35,12 @@ Must first run "helm chart save" or "helm chart pull".
func newChartPushCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { func newChartPushCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
return &cobra.Command{ return &cobra.Command{
Use: "push [ref]", Use: "push [ref]",
Short: "push a chart to remote", DisableFlagsInUseLine: true,
Long: chartPushDesc, Short: "push a chart to remote",
Args: require.MinimumNArgs(1), Long: chartPushDesc,
Hidden: !FeatureGateOCI.IsEnabled(), Args: require.MinimumNArgs(1),
Hidden: !FeatureGateOCI.IsEnabled(),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
ref := args[0] ref := args[0]
return action.NewChartPush(cfg).Run(out, ref) return action.NewChartPush(cfg).Run(out, ref)

@ -36,12 +36,13 @@ To remove all unlinked content, please run "helm chart prune". (TODO)
func newChartRemoveCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { func newChartRemoveCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
return &cobra.Command{ return &cobra.Command{
Use: "remove [ref]", Use: "remove [ref]",
Aliases: []string{"rm"}, DisableFlagsInUseLine: true,
Short: "remove a chart", Aliases: []string{"rm"},
Long: chartRemoveDesc, Short: "remove a chart",
Args: require.MinimumNArgs(1), Long: chartRemoveDesc,
Hidden: !FeatureGateOCI.IsEnabled(), Args: require.MinimumNArgs(1),
Hidden: !FeatureGateOCI.IsEnabled(),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
ref := args[0] ref := args[0]
return action.NewChartRemove(cfg).Run(out, ref) return action.NewChartRemove(cfg).Run(out, ref)

@ -18,6 +18,7 @@ package main
import ( import (
"io" "io"
"k8s.io/kubectl/pkg/util/templates"
"path/filepath" "path/filepath"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -36,11 +37,12 @@ not change the item as it exists in the cache.
func newChartSaveCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { func newChartSaveCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
return &cobra.Command{ return &cobra.Command{
Use: "save [path] [ref]", Use: "save [path] [ref]",
Short: "save a chart directory", DisableFlagsInUseLine: true,
Long: chartSaveDesc, Short: templates.LongDesc("save a chart directory"),
Args: require.MinimumNArgs(2), Long: chartSaveDesc,
Hidden: !FeatureGateOCI.IsEnabled(), Args: require.MinimumNArgs(2),
Hidden: !FeatureGateOCI.IsEnabled(),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
path := args[0] path := args[0]
ref := args[1] ref := args[1]

@ -51,9 +51,10 @@ func newCompletionCmd(out io.Writer) *cobra.Command {
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "completion SHELL", Use: "completion SHELL",
Short: "generate autocompletions script for the specified shell (bash or zsh)", DisableFlagsInUseLine: true,
Long: completionDesc, Short: "generate autocompletions script for the specified shell (bash or zsh)",
Long: completionDesc,
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
return runCompletion(out, cmd, args) return runCompletion(out, cmd, args)
}, },

@ -60,10 +60,11 @@ func newCreateCmd(out io.Writer) *cobra.Command {
o := &createOptions{} o := &createOptions{}
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "create NAME", Use: "create NAME",
Short: "create a new chart with the given name", DisableFlagsInUseLine: true,
Long: createDesc, Short: "create a new chart with the given name",
Args: require.ExactArgs(1), Long: createDesc,
Args: require.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
o.name = args[0] o.name = args[0]
o.starterDir = helmpath.DataPath("starters") o.starterDir = helmpath.DataPath("starters")

@ -84,11 +84,12 @@ This will produce an error if the chart cannot be loaded.
func newDependencyCmd(out io.Writer) *cobra.Command { func newDependencyCmd(out io.Writer) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "dependency update|build|list", Use: "dependency update|build|list",
Aliases: []string{"dep", "dependencies"}, DisableFlagsInUseLine: true,
Short: "manage a chart's dependencies", Aliases: []string{"dep", "dependencies"},
Long: dependencyDesc, Short: "manage a chart's dependencies",
Args: require.NoArgs, Long: dependencyDesc,
Args: require.NoArgs,
} }
cmd.AddCommand(newDependencyListCmd(out)) cmd.AddCommand(newDependencyListCmd(out))
@ -102,11 +103,12 @@ func newDependencyListCmd(out io.Writer) *cobra.Command {
client := action.NewDependency() client := action.NewDependency()
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "list CHART", Use: "list CHART",
Aliases: []string{"ls"}, DisableFlagsInUseLine: true,
Short: "list the dependencies for the given chart", Aliases: []string{"ls"},
Long: dependencyListDesc, Short: "list the dependencies for the given chart",
Args: require.MaximumNArgs(1), Long: dependencyListDesc,
Args: require.MaximumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
chartpath := "." chartpath := "."
if len(args) > 0 { if len(args) > 0 {

@ -44,10 +44,11 @@ func newDependencyBuildCmd(out io.Writer) *cobra.Command {
client := action.NewDependency() client := action.NewDependency()
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "build CHART", Use: "build CHART",
Short: "rebuild the charts/ directory based on the Chart.lock file", DisableFlagsInUseLine: true,
Long: dependencyBuildDesc, Short: "rebuild the charts/ directory based on the Chart.lock file",
Args: require.MaximumNArgs(1), Long: dependencyBuildDesc,
Args: require.MaximumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
chartpath := "." chartpath := "."
if len(args) > 0 { if len(args) > 0 {

@ -47,11 +47,12 @@ func newDependencyUpdateCmd(out io.Writer) *cobra.Command {
client := action.NewDependency() client := action.NewDependency()
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "update CHART", Use: "update CHART",
Aliases: []string{"up"}, DisableFlagsInUseLine: true,
Short: "update charts/ based on the contents of Chart.yaml", Aliases: []string{"up"},
Long: dependencyUpDesc, Short: "update charts/ based on the contents of Chart.yaml",
Args: require.MaximumNArgs(1), Long: dependencyUpDesc,
Args: require.MaximumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
chartpath := "." chartpath := "."
if len(args) > 0 { if len(args) > 0 {

@ -47,11 +47,12 @@ func newDocsCmd(out io.Writer) *cobra.Command {
o := &docsOptions{} o := &docsOptions{}
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "docs", Use: "docs",
Short: "generate documentation as markdown or man pages", DisableFlagsInUseLine: true,
Long: docsDesc, Short: "generate documentation as markdown or man pages",
Hidden: true, Long: docsDesc,
Args: require.NoArgs, Hidden: true,
Args: require.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
o.topCmd = cmd.Root() o.topCmd = cmd.Root()
return o.run(out) return o.run(out)

@ -32,10 +32,11 @@ Env prints out all the environment information in use by Helm.
func newEnvCmd(out io.Writer) *cobra.Command { func newEnvCmd(out io.Writer) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "env", Use: "env",
Short: "helm client environment information", DisableFlagsInUseLine: true,
Long: envHelp, Short: "helm client environment information",
Args: require.NoArgs, Long: envHelp,
Args: require.NoArgs,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
envVars := settings.EnvVars() envVars := settings.EnvVars()

@ -37,10 +37,11 @@ get extended information about the release, including:
func newGetCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { func newGetCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "get", Use: "get",
Short: "download extended information of a named release", DisableFlagsInUseLine: true,
Long: getHelp, Short: "download extended information of a named release",
Args: require.NoArgs, Long: getHelp,
Args: require.NoArgs,
} }
cmd.AddCommand(newGetAllCmd(cfg, out)) cmd.AddCommand(newGetAllCmd(cfg, out))

@ -37,10 +37,11 @@ func newGetAllCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
client := action.NewGet(cfg) client := action.NewGet(cfg)
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "all RELEASE_NAME", Use: "all RELEASE_NAME",
Short: "download all information for a named release", DisableFlagsInUseLine: true,
Long: getAllHelp, Short: "download all information for a named release",
Args: require.ExactArgs(1), Long: getAllHelp,
Args: require.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
res, err := client.Run(args[0]) res, err := client.Run(args[0])
if err != nil { if err != nil {

@ -37,10 +37,11 @@ func newGetHooksCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
client := action.NewGet(cfg) client := action.NewGet(cfg)
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "hooks RELEASE_NAME", Use: "hooks RELEASE_NAME",
Short: "download all hooks for a named release", DisableFlagsInUseLine: true,
Long: getHooksHelp, Short: "download all hooks for a named release",
Args: require.ExactArgs(1), Long: getHooksHelp,
Args: require.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
res, err := client.Run(args[0]) res, err := client.Run(args[0])
if err != nil { if err != nil {

@ -39,10 +39,11 @@ func newGetManifestCmd(cfg *action.Configuration, out io.Writer) *cobra.Command
client := action.NewGet(cfg) client := action.NewGet(cfg)
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "manifest RELEASE_NAME", Use: "manifest RELEASE_NAME",
Short: "download the manifest for a named release", DisableFlagsInUseLine: true,
Long: getManifestHelp, Short: "download the manifest for a named release",
Args: require.ExactArgs(1), Long: getManifestHelp,
Args: require.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
res, err := client.Run(args[0]) res, err := client.Run(args[0])
if err != nil { if err != nil {

@ -35,10 +35,11 @@ func newGetNotesCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
client := action.NewGet(cfg) client := action.NewGet(cfg)
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "notes RELEASE_NAME", Use: "notes RELEASE_NAME",
Short: "download the notes for a named release", DisableFlagsInUseLine: true,
Long: getNotesHelp, Short: "download the notes for a named release",
Args: require.ExactArgs(1), Long: getNotesHelp,
Args: require.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
res, err := client.Run(args[0]) res, err := client.Run(args[0])
if err != nil { if err != nil {

@ -42,10 +42,11 @@ func newGetValuesCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
client := action.NewGetValues(cfg) client := action.NewGetValues(cfg)
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "values RELEASE_NAME", Use: "values RELEASE_NAME",
Short: "download the values file for a named release", DisableFlagsInUseLine: true,
Long: getValuesHelp, Short: "download the values file for a named release",
Args: require.ExactArgs(1), Long: getValuesHelp,
Args: require.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
vals, err := client.Run(args[0]) vals, err := client.Run(args[0])
if err != nil { if err != nil {

@ -56,11 +56,12 @@ func newHistoryCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
var outfmt output.Format var outfmt output.Format
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "history RELEASE_NAME", Use: "history RELEASE_NAME",
Long: historyHelp, DisableFlagsInUseLine: true,
Short: "fetch release history", Long: historyHelp,
Aliases: []string{"hist"}, Short: "fetch release history",
Args: require.ExactArgs(1), Aliases: []string{"hist"},
Args: require.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
history, err := getHistory(client, args[0]) history, err := getHistory(client, args[0])
if err != nil { if err != nil {

@ -109,10 +109,11 @@ func newInstallCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
var outfmt output.Format var outfmt output.Format
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "install [NAME] [CHART]", Use: "install [NAME] [CHART]",
Short: "install a chart", DisableFlagsInUseLine: true,
Long: installDesc, Short: "install a chart",
Args: require.MinimumNArgs(1), Long: installDesc,
Args: require.MinimumNArgs(1),
RunE: func(_ *cobra.Command, args []string) error { RunE: func(_ *cobra.Command, args []string) error {
rel, err := runInstall(args, client, valueOpts, out) rel, err := runInstall(args, client, valueOpts, out)
if err != nil { if err != nil {

@ -45,9 +45,10 @@ func newLintCmd(out io.Writer) *cobra.Command {
valueOpts := &values.Options{} valueOpts := &values.Options{}
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "lint PATH", Use: "lint PATH",
Short: "examine a chart for possible issues", DisableFlagsInUseLine: true,
Long: longLintHelp, Short: "examine a chart for possible issues",
Long: longLintHelp,
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
paths := []string{"."} paths := []string{"."}
if len(args) > 0 { if len(args) > 0 {

@ -64,11 +64,12 @@ func newListCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
var outfmt output.Format var outfmt output.Format
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "list", Use: "list",
Short: "list releases", DisableFlagsInUseLine: true,
Long: listHelp, Short: "list releases",
Aliases: []string{"ls"}, Long: listHelp,
Args: require.NoArgs, Aliases: []string{"ls"},
Args: require.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
if client.AllNamespaces { if client.AllNamespaces {
if err := cfg.Init(settings.RESTClientGetter(), "", os.Getenv("HELM_DRIVER"), debug); err != nil { if err := cfg.Init(settings.RESTClientGetter(), "", os.Getenv("HELM_DRIVER"), debug); err != nil {

@ -26,10 +26,11 @@ import (
// NewCmdOptions implements the options command // NewCmdOptions implements the options command
func newCmdOptions(out io.Writer) *cobra.Command { func newCmdOptions(out io.Writer) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "options", Use: "options",
Short: "print the list of flags inherited by all commands", DisableFlagsInUseLine: true,
Long: "print the list of flags inherited by all commands", Short: "print the list of flags inherited by all commands",
Args: require.NoArgs, Long: "print the list of flags inherited by all commands",
Args: require.NoArgs,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
cmd.Usage() cmd.Usage()
}, },

@ -53,9 +53,10 @@ func newPackageCmd(out io.Writer) *cobra.Command {
valueOpts := &values.Options{} valueOpts := &values.Options{}
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "package [CHART_PATH] [...]", Use: "package [CHART_PATH] [...]",
Short: "package a chart directory into a chart archive", DisableFlagsInUseLine: true,
Long: packageDesc, Short: "package a chart directory into a chart archive",
Long: packageDesc,
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
if len(args) == 0 { if len(args) == 0 {
return errors.Errorf("need at least one argument, the path to the chart") return errors.Errorf("need at least one argument, the path to the chart")

@ -32,9 +32,10 @@ Manage client-side Helm plugins.
func newPluginCmd(out io.Writer) *cobra.Command { func newPluginCmd(out io.Writer) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "plugin", Use: "plugin",
Short: "install, list, or uninstall Helm plugins", DisableFlagsInUseLine: true,
Long: pluginHelp, Short: "install, list, or uninstall Helm plugins",
Long: pluginHelp,
} }
cmd.AddCommand( cmd.AddCommand(
newPluginInstallCmd(out), newPluginInstallCmd(out),

@ -38,11 +38,12 @@ This command allows you to install a plugin from a url to a VCS repo or a local
func newPluginInstallCmd(out io.Writer) *cobra.Command { func newPluginInstallCmd(out io.Writer) *cobra.Command {
o := &pluginInstallOptions{} o := &pluginInstallOptions{}
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "install [options] <path|url>...", Use: "install [options] <path|url>...",
Short: "install one or more Helm plugins", DisableFlagsInUseLine: true,
Long: pluginInstallDesc, Short: "install one or more Helm plugins",
Aliases: []string{"add"}, Long: pluginInstallDesc,
Args: require.ExactArgs(1), Aliases: []string{"add"},
Args: require.ExactArgs(1),
PreRunE: func(cmd *cobra.Command, args []string) error { PreRunE: func(cmd *cobra.Command, args []string) error {
return o.complete(args) return o.complete(args)
}, },

@ -28,9 +28,10 @@ import (
func newPluginListCmd(out io.Writer) *cobra.Command { func newPluginListCmd(out io.Writer) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "list", Use: "list",
Aliases: []string{"ls"}, DisableFlagsInUseLine: true,
Short: "list installed Helm plugins", Aliases: []string{"ls"},
Short: "list installed Helm plugins",
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
debug("pluginDirs: %s", settings.PluginsDirectory) debug("pluginDirs: %s", settings.PluginsDirectory)
plugins, err := plugin.FindPlugins(settings.PluginsDirectory) plugins, err := plugin.FindPlugins(settings.PluginsDirectory)

@ -36,9 +36,10 @@ func newPluginUninstallCmd(out io.Writer) *cobra.Command {
o := &pluginUninstallOptions{} o := &pluginUninstallOptions{}
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "uninstall <plugin>...", Use: "uninstall <plugin>...",
Aliases: []string{"rm", "remove"}, DisableFlagsInUseLine: true,
Short: "uninstall one or more Helm plugins", Aliases: []string{"rm", "remove"},
Short: "uninstall one or more Helm plugins",
PreRunE: func(cmd *cobra.Command, args []string) error { PreRunE: func(cmd *cobra.Command, args []string) error {
return o.complete(args) return o.complete(args)
}, },

@ -37,9 +37,10 @@ func newPluginUpdateCmd(out io.Writer) *cobra.Command {
o := &pluginUpdateOptions{} o := &pluginUpdateOptions{}
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "update <plugin>...", Use: "update <plugin>...",
Aliases: []string{"up"}, DisableFlagsInUseLine: true,
Short: "update one or more Helm plugins", Aliases: []string{"up"},
Short: "update one or more Helm plugins",
PreRunE: func(cmd *cobra.Command, args []string) error { PreRunE: func(cmd *cobra.Command, args []string) error {
return o.complete(args) return o.complete(args)
}, },

@ -46,11 +46,12 @@ func newPullCmd(out io.Writer) *cobra.Command {
client := action.NewPull() client := action.NewPull()
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "pull [chart URL | repo/chartname] [...]", Use: "pull [chart URL | repo/chartname] [...]",
Short: "download a chart from a repository and (optionally) unpack it in local directory", DisableFlagsInUseLine: true,
Aliases: []string{"fetch"}, Short: "download a chart from a repository and (optionally) unpack it in local directory",
Long: pullDesc, Aliases: []string{"fetch"},
Args: require.MinimumNArgs(1), Long: pullDesc,
Args: require.MinimumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
client.Settings = settings client.Settings = settings
if client.Version == "" && client.Devel { if client.Version == "" && client.Devel {

@ -29,11 +29,12 @@ This command consists of multiple subcommands to interact with registries.
func newRegistryCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { func newRegistryCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "registry", Use: "registry",
Short: "login to or logout from a registry", DisableFlagsInUseLine: true,
Long: registryHelp, Short: "login to or logout from a registry",
Hidden: !FeatureGateOCI.IsEnabled(), Long: registryHelp,
PersistentPreRunE: checkOCIFeatureGate(), Hidden: !FeatureGateOCI.IsEnabled(),
PersistentPreRunE: checkOCIFeatureGate(),
} }
cmd.AddCommand( cmd.AddCommand(
newRegistryLoginCmd(cfg, out), newRegistryLoginCmd(cfg, out),

@ -41,11 +41,12 @@ func newRegistryLoginCmd(cfg *action.Configuration, out io.Writer) *cobra.Comman
var passwordFromStdinOpt, insecureOpt bool var passwordFromStdinOpt, insecureOpt bool
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "login [host]", Use: "login [host]",
Short: "login to a registry", DisableFlagsInUseLine: true,
Long: registryLoginDesc, Short: "login to a registry",
Args: require.MinimumNArgs(1), Long: registryLoginDesc,
Hidden: !FeatureGateOCI.IsEnabled(), Args: require.MinimumNArgs(1),
Hidden: !FeatureGateOCI.IsEnabled(),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
hostname := args[0] hostname := args[0]

@ -31,11 +31,12 @@ Remove credentials stored for a remote registry.
func newRegistryLogoutCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { func newRegistryLogoutCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
return &cobra.Command{ return &cobra.Command{
Use: "logout [host]", Use: "logout [host]",
Short: "logout from a registry", DisableFlagsInUseLine: true,
Long: registryLogoutDesc, Short: "logout from a registry",
Args: require.MinimumNArgs(1), Long: registryLogoutDesc,
Hidden: !FeatureGateOCI.IsEnabled(), Args: require.MinimumNArgs(1),
Hidden: !FeatureGateOCI.IsEnabled(),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
hostname := args[0] hostname := args[0]
return action.NewRegistryLogout(cfg).Run(out, hostname) return action.NewRegistryLogout(cfg).Run(out, hostname)

@ -34,10 +34,11 @@ It can be used to add, remove, list, and index chart repositories.
func newRepoCmd(out io.Writer) *cobra.Command { func newRepoCmd(out io.Writer) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "repo add|remove|list|index|update [ARGS]", Use: "repo add|remove|list|index|update [ARGS]",
Short: "add, list, remove, update, and index chart repositories", DisableFlagsInUseLine: true,
Long: repoHelm, Short: "add, list, remove, update, and index chart repositories",
Args: require.NoArgs, Long: repoHelm,
Args: require.NoArgs,
} }
cmd.AddCommand(newRepoAddCmd(out)) cmd.AddCommand(newRepoAddCmd(out))

@ -56,9 +56,10 @@ func newRepoAddCmd(out io.Writer) *cobra.Command {
o := &repoAddOptions{} o := &repoAddOptions{}
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "add [NAME] [URL]", Use: "add [NAME] [URL]",
Short: "add a chart repository", DisableFlagsInUseLine: true,
Args: require.ExactArgs(2), Short: "add a chart repository",
Args: require.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
o.name = args[0] o.name = args[0]
o.url = args[1] o.url = args[1]

@ -49,10 +49,11 @@ func newRepoIndexCmd(out io.Writer) *cobra.Command {
o := &repoIndexOptions{} o := &repoIndexOptions{}
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "index [DIR]", Use: "index [DIR]",
Short: "generate an index file given a directory containing packaged charts", DisableFlagsInUseLine: true,
Long: repoIndexDesc, Short: "generate an index file given a directory containing packaged charts",
Args: require.ExactArgs(1), Long: repoIndexDesc,
Args: require.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
o.dir = args[0] o.dir = args[0]
return o.run(out) return o.run(out)

@ -32,10 +32,11 @@ import (
func newRepoListCmd(out io.Writer) *cobra.Command { func newRepoListCmd(out io.Writer) *cobra.Command {
var outfmt output.Format var outfmt output.Format
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "list", Use: "list",
Aliases: []string{"ls"}, DisableFlagsInUseLine: true,
Short: "list chart repositories", Aliases: []string{"ls"},
Args: require.NoArgs, Short: "list chart repositories",
Args: require.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
f, err := repo.LoadFile(settings.RepositoryConfig) f, err := repo.LoadFile(settings.RepositoryConfig)
if isNotExist(err) || (len(f.Repositories) == 0 && !(outfmt == output.JSON || outfmt == output.YAML)) { if isNotExist(err) || (len(f.Repositories) == 0 && !(outfmt == output.JSON || outfmt == output.YAML)) {

@ -41,10 +41,11 @@ func newRepoRemoveCmd(out io.Writer) *cobra.Command {
o := &repoRemoveOptions{} o := &repoRemoveOptions{}
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "remove [REPO1 [REPO2 ...]]", Use: "remove [REPO1 [REPO2 ...]]",
Aliases: []string{"rm"}, DisableFlagsInUseLine: true,
Short: "remove one or more chart repositories", Aliases: []string{"rm"},
Args: require.MinimumNArgs(1), Short: "remove one or more chart repositories",
Args: require.MinimumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
o.repoFile = settings.RepositoryConfig o.repoFile = settings.RepositoryConfig
o.repoCache = settings.RepositoryCache o.repoCache = settings.RepositoryCache

@ -45,11 +45,12 @@ func newRepoUpdateCmd(out io.Writer) *cobra.Command {
o := &repoUpdateOptions{update: updateCharts} o := &repoUpdateOptions{update: updateCharts}
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "update", Use: "update",
Aliases: []string{"up"}, DisableFlagsInUseLine: true,
Short: "update information of available charts locally from chart repositories", Aliases: []string{"up"},
Long: updateDesc, Short: "update information of available charts locally from chart repositories",
Args: require.NoArgs, Long: updateDesc,
Args: require.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
o.repoFile = settings.RepositoryConfig o.repoFile = settings.RepositoryConfig
return o.run(out) return o.run(out)

@ -43,10 +43,11 @@ func newRollbackCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
client := action.NewRollback(cfg) client := action.NewRollback(cfg)
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "rollback <RELEASE> [REVISION]", Use: "rollback <RELEASE> [REVISION]",
Short: "roll back a release to a previous revision", DisableFlagsInUseLine: true,
Long: rollbackDesc, Short: "roll back a release to a previous revision",
Args: require.MinimumNArgs(1), Long: rollbackDesc,
Args: require.MinimumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
if len(args) > 1 { if len(args) > 1 {
ver, err := strconv.Atoi(args[1]) ver, err := strconv.Atoi(args[1])

@ -71,13 +71,14 @@ By default, the default directories depend on the Operating System. The defaults
func newRootCmd(actionConfig *action.Configuration, out io.Writer, args []string) *cobra.Command { func newRootCmd(actionConfig *action.Configuration, out io.Writer, args []string) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "helm", Use: "helm",
Short: "The Helm package manager for Kubernetes.", DisableFlagsInUseLine: true,
Long: globalUsage, Short: "The Helm package manager for Kubernetes.",
Long: globalUsage,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
cmd.Help() cmd.Help()
}, },
SilenceUsage: true, SilenceUsage: false,
BashCompletionFunction: completion.GetBashCustomFunction(), BashCompletionFunction: completion.GetBashCustomFunction(),
} }
flags := cmd.PersistentFlags() flags := cmd.PersistentFlags()

@ -31,9 +31,10 @@ search subcommands to search different locations for charts.
func newSearchCmd(out io.Writer) *cobra.Command { func newSearchCmd(out io.Writer) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "search [keyword]", Use: "search [keyword]",
Short: "search for a keyword in charts", DisableFlagsInUseLine: true,
Long: searchDesc, Short: "search for a keyword in charts",
Long: searchDesc,
} }
cmd.AddCommand(newSearchHubCmd(out)) cmd.AddCommand(newSearchHubCmd(out))

@ -51,9 +51,10 @@ func newSearchHubCmd(out io.Writer) *cobra.Command {
o := &searchHubOptions{} o := &searchHubOptions{}
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "hub [keyword]", Use: "hub [keyword]",
Short: "search for charts in the Helm Hub or an instance of Monocular", DisableFlagsInUseLine: true,
Long: searchHubDesc, Short: "search for charts in the Helm Hub or an instance of Monocular",
Long: searchHubDesc,
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
return o.run(out, args) return o.run(out, args)
}, },

@ -79,9 +79,10 @@ func newSearchRepoCmd(out io.Writer) *cobra.Command {
o := &searchRepoOptions{} o := &searchRepoOptions{}
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "repo [keyword]", Use: "repo [keyword]",
Short: "search repositories for a keyword in charts", DisableFlagsInUseLine: true,
Long: searchRepoDesc, Short: "search repositories for a keyword in charts",
Long: searchRepoDesc,
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
o.repoFile = settings.RepositoryConfig o.repoFile = settings.RepositoryConfig
o.repoCacheDir = settings.RepositoryCache o.repoCacheDir = settings.RepositoryCache

@ -55,11 +55,12 @@ func newShowCmd(out io.Writer) *cobra.Command {
client := action.NewShow(action.ShowAll) client := action.NewShow(action.ShowAll)
showCommand := &cobra.Command{ showCommand := &cobra.Command{
Use: "show", Use: "show",
Short: "show information of a chart", DisableFlagsInUseLine: true,
Aliases: []string{"inspect"}, Short: "show information of a chart",
Long: showDesc, Aliases: []string{"inspect"},
Args: require.NoArgs, Long: showDesc,
Args: require.NoArgs,
} }
// Function providing dynamic auto-completion // Function providing dynamic auto-completion
@ -71,10 +72,11 @@ func newShowCmd(out io.Writer) *cobra.Command {
} }
all := &cobra.Command{ all := &cobra.Command{
Use: "all [CHART]", Use: "all [CHART]",
Short: "show all information of the chart", DisableFlagsInUseLine: true,
Long: showAllDesc, Short: "show all information of the chart",
Args: require.ExactArgs(1), Long: showAllDesc,
Args: require.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
client.OutputFormat = action.ShowAll client.OutputFormat = action.ShowAll
output, err := runShow(args, client) output, err := runShow(args, client)
@ -87,10 +89,11 @@ func newShowCmd(out io.Writer) *cobra.Command {
} }
valuesSubCmd := &cobra.Command{ valuesSubCmd := &cobra.Command{
Use: "values [CHART]", Use: "values [CHART]",
Short: "show the chart's values", DisableFlagsInUseLine: true,
Long: showValuesDesc, Short: "show the chart's values",
Args: require.ExactArgs(1), Long: showValuesDesc,
Args: require.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
client.OutputFormat = action.ShowValues client.OutputFormat = action.ShowValues
output, err := runShow(args, client) output, err := runShow(args, client)
@ -103,10 +106,11 @@ func newShowCmd(out io.Writer) *cobra.Command {
} }
chartSubCmd := &cobra.Command{ chartSubCmd := &cobra.Command{
Use: "chart [CHART]", Use: "chart [CHART]",
Short: "show the chart's definition", DisableFlagsInUseLine: true,
Long: showChartDesc, Short: "show the chart's definition",
Args: require.ExactArgs(1), Long: showChartDesc,
Args: require.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
client.OutputFormat = action.ShowChart client.OutputFormat = action.ShowChart
output, err := runShow(args, client) output, err := runShow(args, client)
@ -119,10 +123,11 @@ func newShowCmd(out io.Writer) *cobra.Command {
} }
readmeSubCmd := &cobra.Command{ readmeSubCmd := &cobra.Command{
Use: "readme [CHART]", Use: "readme [CHART]",
Short: "show the chart's README", DisableFlagsInUseLine: true,
Long: readmeChartDesc, Short: "show the chart's README",
Args: require.ExactArgs(1), Long: readmeChartDesc,
Args: require.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
client.OutputFormat = action.ShowReadme client.OutputFormat = action.ShowReadme
output, err := runShow(args, client) output, err := runShow(args, client)

@ -49,10 +49,11 @@ func newStatusCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
var outfmt output.Format var outfmt output.Format
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "status RELEASE_NAME", Use: "status RELEASE_NAME",
Short: "display the status of the named release", DisableFlagsInUseLine: true,
Long: statusHelp, Short: "display the status of the named release",
Args: require.ExactArgs(1), Long: statusHelp,
Args: require.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
rel, err := client.Run(args[0]) rel, err := client.Run(args[0])
if err != nil { if err != nil {

@ -52,10 +52,11 @@ func newTemplateCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
var showFiles []string var showFiles []string
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "template [NAME] [CHART]", Use: "template [NAME] [CHART]",
Short: "locally render templates", DisableFlagsInUseLine: true,
Long: templateDesc, Short: "locally render templates",
Args: require.MinimumNArgs(1), Long: templateDesc,
Args: require.MinimumNArgs(1),
RunE: func(_ *cobra.Command, args []string) error { RunE: func(_ *cobra.Command, args []string) error {
client.DryRun = true client.DryRun = true
client.ReleaseName = "RELEASE-NAME" client.ReleaseName = "RELEASE-NAME"

@ -1,3 +1,3 @@
Error: "helm get all" requires 1 argument Error: "helm get all" requires 1 argument
Usage: helm get all RELEASE_NAME [flags] Usage: helm get all RELEASE_NAME

@ -1,3 +1,3 @@
Error: "helm get hooks" requires 1 argument Error: "helm get hooks" requires 1 argument
Usage: helm get hooks RELEASE_NAME [flags] Usage: helm get hooks RELEASE_NAME

@ -1,3 +1,3 @@
Error: "helm get manifest" requires 1 argument Error: "helm get manifest" requires 1 argument
Usage: helm get manifest RELEASE_NAME [flags] Usage: helm get manifest RELEASE_NAME

@ -1,3 +1,3 @@
Error: "helm get notes" requires 1 argument Error: "helm get notes" requires 1 argument
Usage: helm get notes RELEASE_NAME [flags] Usage: helm get notes RELEASE_NAME

@ -1,3 +1,3 @@
Error: "helm get values" requires 1 argument Error: "helm get values" requires 1 argument
Usage: helm get values RELEASE_NAME [flags] Usage: helm get values RELEASE_NAME

@ -1,3 +1,3 @@
Error: "helm install" requires at least 1 argument Error: "helm install" requires at least 1 argument
Usage: helm install [NAME] [CHART] [flags] Usage: helm install [NAME] [CHART]

@ -1,3 +1,3 @@
Error: "helm rollback" requires at least 1 argument Error: "helm rollback" requires at least 1 argument
Usage: helm rollback <RELEASE> [REVISION] [flags] Usage: helm rollback <RELEASE> [REVISION]

@ -1,3 +1,3 @@
Error: "helm template" requires at least 1 argument Error: "helm template" requires at least 1 argument
Usage: helm template [NAME] [CHART] [flags] Usage: helm template [NAME] [CHART]

@ -1,3 +1,3 @@
Error: "helm uninstall" requires at least 1 argument Error: "helm uninstall" requires at least 1 argument
Usage: helm uninstall RELEASE_NAME [...] [flags] Usage: helm uninstall RELEASE_NAME [...]

@ -42,12 +42,13 @@ func newUninstallCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
client := action.NewUninstall(cfg) client := action.NewUninstall(cfg)
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "uninstall RELEASE_NAME [...]", Use: "uninstall RELEASE_NAME [...]",
Aliases: []string{"del", "delete", "un"}, DisableFlagsInUseLine: true,
SuggestFor: []string{"remove", "rm"}, Aliases: []string{"del", "delete", "un"},
Short: "uninstall a release", SuggestFor: []string{"remove", "rm"},
Long: uninstallDesc, Short: "uninstall a release",
Args: require.MinimumNArgs(1), Long: uninstallDesc,
Args: require.MinimumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
for i := 0; i < len(args); i++ { for i := 0; i < len(args); i++ {

@ -68,10 +68,11 @@ func newUpgradeCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
var createNamespace bool var createNamespace bool
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "upgrade [RELEASE] [CHART]", Use: "upgrade [RELEASE] [CHART]",
Short: "upgrade a release", DisableFlagsInUseLine: true,
Long: upgradeDesc, Short: "upgrade a release",
Args: require.ExactArgs(2), Long: upgradeDesc,
Args: require.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
client.Namespace = settings.Namespace() client.Namespace = settings.Namespace()

@ -40,10 +40,11 @@ func newVerifyCmd(out io.Writer) *cobra.Command {
client := action.NewVerify() client := action.NewVerify()
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "verify PATH", Use: "verify PATH",
Short: "verify that a chart at the given path has been signed and is valid", DisableFlagsInUseLine: true,
Long: verifyDesc, Short: "verify that a chart at the given path has been signed and is valid",
Args: require.ExactArgs(1), Long: verifyDesc,
Args: require.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
err := client.Run(args[0]) err := client.Run(args[0])
if err != nil { if err != nil {

@ -41,7 +41,7 @@ func TestVerifyCmd(t *testing.T) {
{ {
name: "verify requires a chart", name: "verify requires a chart",
cmd: "verify", cmd: "verify",
expect: "\"helm verify\" requires 1 argument\n\nUsage: helm verify PATH [flags]", expect: "\"helm verify\" requires 1 argument\n\nUsage: helm verify PATH",
wantError: true, wantError: true,
}, },
{ {

@ -58,10 +58,11 @@ func newVersionCmd(out io.Writer) *cobra.Command {
o := &versionOptions{} o := &versionOptions{}
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "version", Use: "version",
Short: "print the client version information", DisableFlagsInUseLine: true,
Long: versionDesc, Short: "print the client version information",
Args: require.NoArgs, Long: versionDesc,
Args: require.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
return o.run(out) return o.run(out)
}, },

Loading…
Cancel
Save