Using cobra mechanism to restrict number of arguments given to explicit recon.

This commit is contained in:
Renan DelValle 2018-10-23 15:30:41 -07:00
parent 112f172c64
commit 50ec7cad2c
No known key found for this signature in database
GPG key ID: C240AD6D6F443EC9

View file

@ -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{