diff --git a/cmd/env.go b/cmd/env.go index 7e881818d92cdf4560b7ccfb0059f2e8562476c6..72fb9940db0a71437ca6580a99e5d4fceab5aa8d 100644 --- a/cmd/env.go +++ b/cmd/env.go @@ -18,6 +18,7 @@ package cmd import ( "fmt" "os" + "strings" "github.com/spf13/cobra" "github.com/spf13/pflag" @@ -90,6 +91,9 @@ uniquely identifies the cluster. staging.jsonnet params.libsonnet`, RunE: func(cmd *cobra.Command, args []string) error { + if len(args) != 0 { + return fmt.Errorf("%s is not a valid subcommand\n\n%s", strings.Join(args, " "), cmd.UsageString()) + } return fmt.Errorf("Command 'env' requires a subcommand\n\n%s", cmd.UsageString()) }, } diff --git a/cmd/param.go b/cmd/param.go index e5a8c34a59841ab412d581c0b438ee967917a7e3..7b9b91208452c8607fbfec8b9d0a380bf2184c48 100644 --- a/cmd/param.go +++ b/cmd/param.go @@ -17,6 +17,7 @@ package cmd import ( "fmt" + "strings" "github.com/spf13/cobra" @@ -58,6 +59,9 @@ run: ks env --help `, RunE: func(cmd *cobra.Command, args []string) error { + if len(args) != 0 { + return fmt.Errorf("%s is not a valid subcommand\n\n%s", strings.Join(args, " "), cmd.UsageString()) + } return fmt.Errorf("Command 'param' requires a subcommand\n\n%s", cmd.UsageString()) }, } diff --git a/cmd/pkg.go b/cmd/pkg.go index cbaa40b064a824dab776b517e755de001f5aafda..4e1c65e01cc01b3489acf8885c2ac4ca1bf11a34 100644 --- a/cmd/pkg.go +++ b/cmd/pkg.go @@ -44,6 +44,9 @@ var pkgCmd = &cobra.Command{ Use: "pkg", Short: `Manage packages and dependencies for the current ksonnet project`, RunE: func(cmd *cobra.Command, args []string) error { + if len(args) != 0 { + return fmt.Errorf("%s is not a valid subcommand\n\n%s", strings.Join(args, " "), cmd.UsageString()) + } return fmt.Errorf("Command 'pkg' requires a subcommand\n\n%s", cmd.UsageString()) }, } diff --git a/cmd/prototype.go b/cmd/prototype.go index d87f137dffb7733f12df69f661d2d7555c9608f1..11cd1a5292b204814b2afbcd6bd5d2c526b9381b 100644 --- a/cmd/prototype.go +++ b/cmd/prototype.go @@ -44,6 +44,9 @@ var prototypeCmd = &cobra.Command{ Use: "prototype", Short: `Instantiate, inspect, and get examples for ksonnet prototypes`, RunE: func(cmd *cobra.Command, args []string) error { + if len(args) != 0 { + return fmt.Errorf("%s is not a valid subcommand\n\n%s", strings.Join(args, " "), cmd.UsageString()) + } return fmt.Errorf("Command 'prototype' requires a subcommand\n\n%s", cmd.UsageString()) }, Long: `Manage, inspect, instantiate, and get examples for ksonnet prototypes. diff --git a/cmd/registry.go b/cmd/registry.go index bf467396da6d8ddaae9e2d94c7d711f321a8d1f5..87339173eace8fe9cc4509d85c9b3348e10e60dc 100644 --- a/cmd/registry.go +++ b/cmd/registry.go @@ -20,6 +20,9 @@ var registryCmd = &cobra.Command{ Use: "registry", Short: `Manage registries for current project`, RunE: func(cmd *cobra.Command, args []string) error { + if len(args) != 0 { + return fmt.Errorf("%s is not a valid subcommand\n\n%s", strings.Join(args, " "), cmd.UsageString()) + } return fmt.Errorf("Command 'registry' requires a subcommand\n\n%s", cmd.UsageString()) }, Long: `Manage and inspect ksonnet registries.