use cobra's arg-count validation & call Complete() before Validate()

Signed-off-by: Steve Kriss <steve@heptio.com>
This commit is contained in:
Steve Kriss
2018-04-03 09:45:29 -07:00
parent a2f5e14a32
commit c60e47dedd
13 changed files with 18 additions and 67 deletions
+1 -4
View File
@@ -60,11 +60,8 @@ func NewCommand() *cobra.Command {
Use: "run-plugin [KIND] [NAME]",
Hidden: true,
Short: "INTERNAL COMMAND ONLY - not intended to be run directly by users",
Args: cobra.ExactArgs(2),
Run: func(c *cobra.Command, args []string) {
if len(args) != 2 {
logger.Fatal("You must specify exactly two arguments, the plugin kind and the plugin name")
}
kind := args[0]
name := args[1]