diff --git a/fleetctl/destroy.go b/fleetctl/destroy.go index d00778aa1..28154ac01 100644 --- a/fleetctl/destroy.go +++ b/fleetctl/destroy.go @@ -29,6 +29,10 @@ Destroyed units are impossible to start unless re-submitted.`, } func runDestroyUnits(args []string) (exit int) { + if len(args) != 1 { + stderr("One unit file must be provided.") + return 1 + } for _, v := range args { name := unitNameMangle(v) err := cAPI.DestroyUnit(name) diff --git a/fleetctl/load.go b/fleetctl/load.go index 497f86058..1841973a6 100644 --- a/fleetctl/load.go +++ b/fleetctl/load.go @@ -46,6 +46,10 @@ func init() { } func runLoadUnits(args []string) (exit int) { + if len(args) != 1 { + stderr("One unit file must be provided.") + return 1 + } if err := lazyCreateUnits(args); err != nil { stderr("Error creating units: %v", err) return 1 diff --git a/fleetctl/start.go b/fleetctl/start.go index 77ea0d343..fe7ce27b1 100644 --- a/fleetctl/start.go +++ b/fleetctl/start.go @@ -54,6 +54,10 @@ func init() { } func runStartUnit(args []string) (exit int) { + if len(args) != 1 { + stderr("One unit file must be provided.") + return 1 + } if err := lazyCreateUnits(args); err != nil { stderr("Error creating units: %v", err) return 1 diff --git a/fleetctl/status.go b/fleetctl/status.go index c1b065f1b..0953a265c 100644 --- a/fleetctl/status.go +++ b/fleetctl/status.go @@ -44,6 +44,10 @@ func init() { } func runStatusUnits(args []string) (exit int) { + if len(args) != 1 { + stderr("One unit file must be provided.") + return 1 + } units, err := cAPI.Units() if err != nil { stderr("Error retrieving unit: %v", err) diff --git a/fleetctl/stop.go b/fleetctl/stop.go index 262946bfb..107a167e3 100644 --- a/fleetctl/stop.go +++ b/fleetctl/stop.go @@ -52,6 +52,10 @@ func init() { } func runStopUnit(args []string) (exit int) { + if len(args) != 1 { + stderr("One unit file must be provided.") + return 1 + } units, err := findUnits(args) if err != nil { stderr("%v", err) diff --git a/fleetctl/submit.go b/fleetctl/submit.go index cbfe03f93..7be065b13 100644 --- a/fleetctl/submit.go +++ b/fleetctl/submit.go @@ -36,6 +36,10 @@ func init() { } func runSubmitUnits(args []string) (exit int) { + if len(args) != 1 { + stderr("One unit file must be provided.") + return 1 + } if err := lazyCreateUnits(args); err != nil { stderr("Error creating units: %v", err) exit = 1 diff --git a/fleetctl/unload.go b/fleetctl/unload.go index 6758f2825..a95514bfb 100644 --- a/fleetctl/unload.go +++ b/fleetctl/unload.go @@ -36,6 +36,10 @@ func init() { } func runUnloadUnit(args []string) (exit int) { + if len(args) != 1 { + stderr("One unit file must be provided.") + return 1 + } units, err := findUnits(args) if err != nil { stderr("%v", err)