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 {
cmd := &cobra.Command{
Use: "chart",
Short: "push, pull, tag, or remove Helm charts",
Long: chartHelp,
Hidden: !FeatureGateOCI.IsEnabled(),
PersistentPreRunE: checkOCIFeatureGate(),
Use: "chart",
DisableFlagsInUseLine: true,
Short: "push, pull, tag, or remove Helm charts",
Long: chartHelp,
Hidden: !FeatureGateOCI.IsEnabled(),
PersistentPreRunE: checkOCIFeatureGate(),
}
cmd.AddCommand(
newChartListCmd(cfg, out),

@ -37,11 +37,12 @@ func newChartExportCmd(cfg *action.Configuration, out io.Writer) *cobra.Command
client := action.NewChartExport(cfg)
cmd := &cobra.Command{
Use: "export [ref]",
Short: "export a chart to directory",
Long: chartExportDesc,
Args: require.MinimumNArgs(1),
Hidden: !FeatureGateOCI.IsEnabled(),
Use: "export [ref]",
DisableFlagsInUseLine: true,
Short: "export a chart to directory",
Long: chartExportDesc,
Args: require.MinimumNArgs(1),
Hidden: !FeatureGateOCI.IsEnabled(),
RunE: func(cmd *cobra.Command, args []string) error {
ref := args[0]
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 {
return &cobra.Command{
Use: "list",
Aliases: []string{"ls"},
Short: "list all saved charts",
Long: chartListDesc,
Hidden: !FeatureGateOCI.IsEnabled(),
Use: "list",
DisableFlagsInUseLine: true,
Aliases: []string{"ls"},
Short: "list all saved charts",
Long: chartListDesc,
Hidden: !FeatureGateOCI.IsEnabled(),
RunE: func(cmd *cobra.Command, args []string) error {
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 {
return &cobra.Command{
Use: "pull [ref]",
Short: "pull a chart from remote",
Long: chartPullDesc,
Args: require.MinimumNArgs(1),
Hidden: !FeatureGateOCI.IsEnabled(),
Use: "pull [ref]",
DisableFlagsInUseLine: true,
Short: "pull a chart from remote",
Long: chartPullDesc,
Args: require.MinimumNArgs(1),
Hidden: !FeatureGateOCI.IsEnabled(),
RunE: func(cmd *cobra.Command, args []string) error {
ref := args[0]
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 {
return &cobra.Command{
Use: "push [ref]",
Short: "push a chart to remote",
Long: chartPushDesc,
Args: require.MinimumNArgs(1),
Hidden: !FeatureGateOCI.IsEnabled(),
Use: "push [ref]",
DisableFlagsInUseLine: true,
Short: "push a chart to remote",
Long: chartPushDesc,
Args: require.MinimumNArgs(1),
Hidden: !FeatureGateOCI.IsEnabled(),
RunE: func(cmd *cobra.Command, args []string) error {
ref := args[0]
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 {
return &cobra.Command{
Use: "remove [ref]",
Aliases: []string{"rm"},
Short: "remove a chart",
Long: chartRemoveDesc,
Args: require.MinimumNArgs(1),
Hidden: !FeatureGateOCI.IsEnabled(),
Use: "remove [ref]",
DisableFlagsInUseLine: true,
Aliases: []string{"rm"},
Short: "remove a chart",
Long: chartRemoveDesc,
Args: require.MinimumNArgs(1),
Hidden: !FeatureGateOCI.IsEnabled(),
RunE: func(cmd *cobra.Command, args []string) error {
ref := args[0]
return action.NewChartRemove(cfg).Run(out, ref)

@ -18,6 +18,7 @@ package main
import (
"io"
"k8s.io/kubectl/pkg/util/templates"
"path/filepath"
"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 {
return &cobra.Command{
Use: "save [path] [ref]",
Short: "save a chart directory",
Long: chartSaveDesc,
Args: require.MinimumNArgs(2),
Hidden: !FeatureGateOCI.IsEnabled(),
Use: "save [path] [ref]",
DisableFlagsInUseLine: true,
Short: templates.LongDesc("save a chart directory"),
Long: chartSaveDesc,
Args: require.MinimumNArgs(2),
Hidden: !FeatureGateOCI.IsEnabled(),
RunE: func(cmd *cobra.Command, args []string) error {
path := args[0]
ref := args[1]

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

@ -60,10 +60,11 @@ func newCreateCmd(out io.Writer) *cobra.Command {
o := &createOptions{}
cmd := &cobra.Command{
Use: "create NAME",
Short: "create a new chart with the given name",
Long: createDesc,
Args: require.ExactArgs(1),
Use: "create NAME",
DisableFlagsInUseLine: true,
Short: "create a new chart with the given name",
Long: createDesc,
Args: require.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
o.name = args[0]
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 {
cmd := &cobra.Command{
Use: "dependency update|build|list",
Aliases: []string{"dep", "dependencies"},
Short: "manage a chart's dependencies",
Long: dependencyDesc,
Args: require.NoArgs,
Use: "dependency update|build|list",
DisableFlagsInUseLine: true,
Aliases: []string{"dep", "dependencies"},
Short: "manage a chart's dependencies",
Long: dependencyDesc,
Args: require.NoArgs,
}
cmd.AddCommand(newDependencyListCmd(out))
@ -102,11 +103,12 @@ func newDependencyListCmd(out io.Writer) *cobra.Command {
client := action.NewDependency()
cmd := &cobra.Command{
Use: "list CHART",
Aliases: []string{"ls"},
Short: "list the dependencies for the given chart",
Long: dependencyListDesc,
Args: require.MaximumNArgs(1),
Use: "list CHART",
DisableFlagsInUseLine: true,
Aliases: []string{"ls"},
Short: "list the dependencies for the given chart",
Long: dependencyListDesc,
Args: require.MaximumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
chartpath := "."
if len(args) > 0 {

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

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

@ -47,11 +47,12 @@ func newDocsCmd(out io.Writer) *cobra.Command {
o := &docsOptions{}
cmd := &cobra.Command{
Use: "docs",
Short: "generate documentation as markdown or man pages",
Long: docsDesc,
Hidden: true,
Args: require.NoArgs,
Use: "docs",
DisableFlagsInUseLine: true,
Short: "generate documentation as markdown or man pages",
Long: docsDesc,
Hidden: true,
Args: require.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
o.topCmd = cmd.Root()
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 {
cmd := &cobra.Command{
Use: "env",
Short: "helm client environment information",
Long: envHelp,
Args: require.NoArgs,
Use: "env",
DisableFlagsInUseLine: true,
Short: "helm client environment information",
Long: envHelp,
Args: require.NoArgs,
Run: func(cmd *cobra.Command, args []string) {
envVars := settings.EnvVars()

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

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

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

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

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

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

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

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

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

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

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

@ -53,9 +53,10 @@ func newPackageCmd(out io.Writer) *cobra.Command {
valueOpts := &values.Options{}
cmd := &cobra.Command{
Use: "package [CHART_PATH] [...]",
Short: "package a chart directory into a chart archive",
Long: packageDesc,
Use: "package [CHART_PATH] [...]",
DisableFlagsInUseLine: true,
Short: "package a chart directory into a chart archive",
Long: packageDesc,
RunE: func(cmd *cobra.Command, args []string) error {
if len(args) == 0 {
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 {
cmd := &cobra.Command{
Use: "plugin",
Short: "install, list, or uninstall Helm plugins",
Long: pluginHelp,
Use: "plugin",
DisableFlagsInUseLine: true,
Short: "install, list, or uninstall Helm plugins",
Long: pluginHelp,
}
cmd.AddCommand(
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 {
o := &pluginInstallOptions{}
cmd := &cobra.Command{
Use: "install [options] <path|url>...",
Short: "install one or more Helm plugins",
Long: pluginInstallDesc,
Aliases: []string{"add"},
Args: require.ExactArgs(1),
Use: "install [options] <path|url>...",
DisableFlagsInUseLine: true,
Short: "install one or more Helm plugins",
Long: pluginInstallDesc,
Aliases: []string{"add"},
Args: require.ExactArgs(1),
PreRunE: func(cmd *cobra.Command, args []string) error {
return o.complete(args)
},

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

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

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

@ -46,11 +46,12 @@ func newPullCmd(out io.Writer) *cobra.Command {
client := action.NewPull()
cmd := &cobra.Command{
Use: "pull [chart URL | repo/chartname] [...]",
Short: "download a chart from a repository and (optionally) unpack it in local directory",
Aliases: []string{"fetch"},
Long: pullDesc,
Args: require.MinimumNArgs(1),
Use: "pull [chart URL | repo/chartname] [...]",
DisableFlagsInUseLine: true,
Short: "download a chart from a repository and (optionally) unpack it in local directory",
Aliases: []string{"fetch"},
Long: pullDesc,
Args: require.MinimumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
client.Settings = settings
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 {
cmd := &cobra.Command{
Use: "registry",
Short: "login to or logout from a registry",
Long: registryHelp,
Hidden: !FeatureGateOCI.IsEnabled(),
PersistentPreRunE: checkOCIFeatureGate(),
Use: "registry",
DisableFlagsInUseLine: true,
Short: "login to or logout from a registry",
Long: registryHelp,
Hidden: !FeatureGateOCI.IsEnabled(),
PersistentPreRunE: checkOCIFeatureGate(),
}
cmd.AddCommand(
newRegistryLoginCmd(cfg, out),

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

@ -31,11 +31,12 @@ Remove credentials stored for a remote registry.
func newRegistryLogoutCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
return &cobra.Command{
Use: "logout [host]",
Short: "logout from a registry",
Long: registryLogoutDesc,
Args: require.MinimumNArgs(1),
Hidden: !FeatureGateOCI.IsEnabled(),
Use: "logout [host]",
DisableFlagsInUseLine: true,
Short: "logout from a registry",
Long: registryLogoutDesc,
Args: require.MinimumNArgs(1),
Hidden: !FeatureGateOCI.IsEnabled(),
RunE: func(cmd *cobra.Command, args []string) error {
hostname := args[0]
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 {
cmd := &cobra.Command{
Use: "repo add|remove|list|index|update [ARGS]",
Short: "add, list, remove, update, and index chart repositories",
Long: repoHelm,
Args: require.NoArgs,
Use: "repo add|remove|list|index|update [ARGS]",
DisableFlagsInUseLine: true,
Short: "add, list, remove, update, and index chart repositories",
Long: repoHelm,
Args: require.NoArgs,
}
cmd.AddCommand(newRepoAddCmd(out))

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

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

@ -32,10 +32,11 @@ import (
func newRepoListCmd(out io.Writer) *cobra.Command {
var outfmt output.Format
cmd := &cobra.Command{
Use: "list",
Aliases: []string{"ls"},
Short: "list chart repositories",
Args: require.NoArgs,
Use: "list",
DisableFlagsInUseLine: true,
Aliases: []string{"ls"},
Short: "list chart repositories",
Args: require.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
f, err := repo.LoadFile(settings.RepositoryConfig)
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{}
cmd := &cobra.Command{
Use: "remove [REPO1 [REPO2 ...]]",
Aliases: []string{"rm"},
Short: "remove one or more chart repositories",
Args: require.MinimumNArgs(1),
Use: "remove [REPO1 [REPO2 ...]]",
DisableFlagsInUseLine: true,
Aliases: []string{"rm"},
Short: "remove one or more chart repositories",
Args: require.MinimumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
o.repoFile = settings.RepositoryConfig
o.repoCache = settings.RepositoryCache

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

@ -43,10 +43,11 @@ func newRollbackCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
client := action.NewRollback(cfg)
cmd := &cobra.Command{
Use: "rollback <RELEASE> [REVISION]",
Short: "roll back a release to a previous revision",
Long: rollbackDesc,
Args: require.MinimumNArgs(1),
Use: "rollback <RELEASE> [REVISION]",
DisableFlagsInUseLine: true,
Short: "roll back a release to a previous revision",
Long: rollbackDesc,
Args: require.MinimumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
if len(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 {
cmd := &cobra.Command{
Use: "helm",
Short: "The Helm package manager for Kubernetes.",
Long: globalUsage,
Use: "helm",
DisableFlagsInUseLine: true,
Short: "The Helm package manager for Kubernetes.",
Long: globalUsage,
Run: func(cmd *cobra.Command, args []string) {
cmd.Help()
},
SilenceUsage: true,
SilenceUsage: false,
BashCompletionFunction: completion.GetBashCustomFunction(),
}
flags := cmd.PersistentFlags()

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

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

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

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

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

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

@ -1,3 +1,3 @@
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
Usage: helm get hooks RELEASE_NAME [flags]
Usage: helm get hooks RELEASE_NAME

@ -1,3 +1,3 @@
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
Usage: helm get notes RELEASE_NAME [flags]
Usage: helm get notes RELEASE_NAME

@ -1,3 +1,3 @@
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
Usage: helm install [NAME] [CHART] [flags]
Usage: helm install [NAME] [CHART]

@ -1,3 +1,3 @@
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
Usage: helm template [NAME] [CHART] [flags]
Usage: helm template [NAME] [CHART]

@ -1,3 +1,3 @@
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)
cmd := &cobra.Command{
Use: "uninstall RELEASE_NAME [...]",
Aliases: []string{"del", "delete", "un"},
SuggestFor: []string{"remove", "rm"},
Short: "uninstall a release",
Long: uninstallDesc,
Args: require.MinimumNArgs(1),
Use: "uninstall RELEASE_NAME [...]",
DisableFlagsInUseLine: true,
Aliases: []string{"del", "delete", "un"},
SuggestFor: []string{"remove", "rm"},
Short: "uninstall a release",
Long: uninstallDesc,
Args: require.MinimumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
for i := 0; i < len(args); i++ {

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

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

@ -41,7 +41,7 @@ func TestVerifyCmd(t *testing.T) {
{
name: "verify requires a chart",
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,
},
{

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

Loading…
Cancel
Save