From 50ec7cad2cacfb6af618f6a428da758e2eb53959 Mon Sep 17 00:00:00 2001 From: Renan DelValle Date: Tue, 23 Oct 2018 15:30:41 -0700 Subject: [PATCH] Using cobra mechanism to restrict number of arguments given to explicit recon. --- cmd/force.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/cmd/force.go b/cmd/force.go index c3cabe3..13323a4 100644 --- a/cmd/force.go +++ b/cmd/force.go @@ -84,6 +84,7 @@ var forceExplicitReconCmd = &cobra.Command{ and the master responds with the latest state for each task, if possible. `, Run: explicitRecon, + Args: cobra.MaximumNArgs(1), } func explicitRecon(cmd *cobra.Command, args []string) { @@ -91,11 +92,6 @@ func explicitRecon(cmd *cobra.Command, args []string) { fmt.Println("Forcing scheduler to perform an explicit reconciliation with Mesos") - if len(args) > 1 || len(args) < 0 { - fmt.Println("Only provide a batch size.") - os.Exit(1) - } - switch len(args) { case 0: fmt.Println("Using default batch size for explicit recon.") @@ -122,7 +118,6 @@ func explicitRecon(cmd *cobra.Command, args []string) { } else { fmt.Println("Explicit reconciliation started successfully") } - } var forceImplicitReconCmd = &cobra.Command{