Merge pull request #35206 from juanvallejo/jvallejo/exit-w-errorcode-on-non-existent-cmds

Automatic merge from submit-queue

update default run function for sub-commands

**Release note**:

``` release-note
release-note-none
```

This patch updates parent commands of sub-commands to exit with a usage
error and exit code 1 on an invalid (non-sub-command) argument.

cc @kargakis
This commit is contained in:
Kubernetes Submit Queue
2016-11-05 07:33:46 -07:00
committed by GitHub
11 changed files with 40 additions and 40 deletions

View File

@@ -242,7 +242,7 @@ func NewKubectlCommand(f cmdutil.Factory, in io.Reader, out, err io.Writer) *cob
{
Message: "Deploy Commands:",
Commands: []*cobra.Command{
rollout.NewCmdRollout(f, out),
rollout.NewCmdRollout(f, out, err),
NewCmdRollingUpdate(f, out),
NewCmdScale(f, out),
NewCmdAutoscale(f, out),
@@ -252,7 +252,7 @@ func NewKubectlCommand(f cmdutil.Factory, in io.Reader, out, err io.Writer) *cob
Message: "Cluster Management Commands:",
Commands: []*cobra.Command{
NewCmdClusterInfo(f, out),
NewCmdTop(f, out),
NewCmdTop(f, out, err),
NewCmdCordon(f, out),
NewCmdUncordon(f, out),
NewCmdDrain(f, out),
@@ -307,7 +307,7 @@ func NewKubectlCommand(f cmdutil.Factory, in io.Reader, out, err io.Writer) *cob
)
}
cmds.AddCommand(cmdconfig.NewCmdConfig(clientcmd.NewDefaultPathOptions(), out))
cmds.AddCommand(cmdconfig.NewCmdConfig(clientcmd.NewDefaultPathOptions(), out, err))
cmds.AddCommand(NewCmdVersion(f, out))
cmds.AddCommand(NewCmdApiVersions(f, out))
cmds.AddCommand(NewCmdOptions(out))