diff --git a/command/job_allocs.go b/command/job_allocs.go index 221df1b79..a976f789c 100644 --- a/command/job_allocs.go +++ b/command/job_allocs.go @@ -118,11 +118,7 @@ func (c *JobAllocsCommand) Run(args []string) int { return 1 } if len(jobs) > 1 { - if jobID != jobs[0].ID { - c.Ui.Error(fmt.Sprintf("Prefix matched multiple jobs\n\n%s", createStatusListOutput(jobs, c.allNamespaces()))) - return 1 - } - if c.allNamespaces() && jobs[0].ID == jobs[1].ID { + if (jobID != jobs[0].ID) || (c.allNamespaces() && jobs[0].ID == jobs[1].ID) { c.Ui.Error(fmt.Sprintf("Prefix matched multiple jobs\n\n%s", createStatusListOutput(jobs, c.allNamespaces()))) return 1 } diff --git a/command/job_deployments.go b/command/job_deployments.go index 12a5204c6..a6c3abc8c 100644 --- a/command/job_deployments.go +++ b/command/job_deployments.go @@ -123,11 +123,7 @@ func (c *JobDeploymentsCommand) Run(args []string) int { return 1 } if len(jobs) > 1 { - if jobID != jobs[0].ID { - c.Ui.Error(fmt.Sprintf("Prefix matched multiple jobs\n\n%s", createStatusListOutput(jobs, c.allNamespaces()))) - return 1 - } - if c.allNamespaces() && jobs[0].ID == jobs[1].ID { + if (jobID != jobs[0].ID) || (c.allNamespaces() && jobs[0].ID == jobs[1].ID) { c.Ui.Error(fmt.Sprintf("Prefix matched multiple jobs\n\n%s", createStatusListOutput(jobs, c.allNamespaces()))) return 1 } diff --git a/command/job_history.go b/command/job_history.go index ebe87d1d7..05e05aa3d 100644 --- a/command/job_history.go +++ b/command/job_history.go @@ -134,11 +134,7 @@ func (c *JobHistoryCommand) Run(args []string) int { return 1 } if len(jobs) > 1 { - if jobID != jobs[0].ID { - c.Ui.Error(fmt.Sprintf("Prefix matched multiple jobs\n\n%s", createStatusListOutput(jobs, c.allNamespaces()))) - return 1 - } - if c.allNamespaces() && jobs[0].ID == jobs[1].ID { + if (jobID != jobs[0].ID) || (c.allNamespaces() && jobs[0].ID == jobs[1].ID) { c.Ui.Error(fmt.Sprintf("Prefix matched multiple jobs\n\n%s", createStatusListOutput(jobs, c.allNamespaces()))) return 1 } diff --git a/command/job_inspect.go b/command/job_inspect.go index fe6aca6c7..8cf2f36eb 100644 --- a/command/job_inspect.go +++ b/command/job_inspect.go @@ -130,11 +130,7 @@ func (c *JobInspectCommand) Run(args []string) int { return 1 } if len(jobs) > 1 { - if jobID != jobs[0].ID { - c.Ui.Error(fmt.Sprintf("Prefix matched multiple jobs\n\n%s", createStatusListOutput(jobs, c.allNamespaces()))) - return 1 - } - if c.allNamespaces() && jobs[0].ID == jobs[1].ID { + if (jobID != jobs[0].ID) || (c.allNamespaces() && jobs[0].ID == jobs[1].ID) { c.Ui.Error(fmt.Sprintf("Prefix matched multiple jobs\n\n%s", createStatusListOutput(jobs, c.allNamespaces()))) return 1 } diff --git a/command/job_promote.go b/command/job_promote.go index 4fcbcabf7..9ec99eb9a 100644 --- a/command/job_promote.go +++ b/command/job_promote.go @@ -128,11 +128,7 @@ func (c *JobPromoteCommand) Run(args []string) int { return 1 } if len(jobs) > 1 { - if jobID != jobs[0].ID { - c.Ui.Error(fmt.Sprintf("Prefix matched multiple jobs\n\n%s", createStatusListOutput(jobs, c.allNamespaces()))) - return 1 - } - if c.allNamespaces() && jobs[0].ID == jobs[1].ID { + if (jobID != jobs[0].ID) || (c.allNamespaces() && jobs[0].ID == jobs[1].ID) { c.Ui.Error(fmt.Sprintf("Prefix matched multiple jobs\n\n%s", createStatusListOutput(jobs, c.allNamespaces()))) return 1 } diff --git a/command/job_revert.go b/command/job_revert.go index ac9ffeb3b..99d7bdd90 100644 --- a/command/job_revert.go +++ b/command/job_revert.go @@ -148,11 +148,7 @@ func (c *JobRevertCommand) Run(args []string) int { return 1 } if len(jobs) > 1 { - if jobID != jobs[0].ID { - c.Ui.Error(fmt.Sprintf("Prefix matched multiple jobs\n\n%s", createStatusListOutput(jobs, c.allNamespaces()))) - return 1 - } - if c.allNamespaces() && jobs[0].ID == jobs[1].ID { + if (jobID != jobs[0].ID) || (c.allNamespaces() && jobs[0].ID == jobs[1].ID) { c.Ui.Error(fmt.Sprintf("Prefix matched multiple jobs\n\n%s", createStatusListOutput(jobs, c.allNamespaces()))) return 1 } diff --git a/command/job_status.go b/command/job_status.go index c6266ae9b..1637b6b58 100644 --- a/command/job_status.go +++ b/command/job_status.go @@ -158,11 +158,7 @@ func (c *JobStatusCommand) Run(args []string) int { return 1 } if len(jobs) > 1 { - if jobID != jobs[0].ID { - c.Ui.Error(fmt.Sprintf("Prefix matched multiple jobs\n\n%s", createStatusListOutput(jobs, allNamespaces))) - return 1 - } - if allNamespaces && jobs[0].ID == jobs[1].ID { + if (jobID != jobs[0].ID) || (allNamespaces && jobs[0].ID == jobs[1].ID) { c.Ui.Error(fmt.Sprintf("Prefix matched multiple jobs\n\n%s", createStatusListOutput(jobs, allNamespaces))) return 1 } diff --git a/command/job_stop.go b/command/job_stop.go index cbfed7638..06aff8087 100644 --- a/command/job_stop.go +++ b/command/job_stop.go @@ -136,11 +136,7 @@ func (c *JobStopCommand) Run(args []string) int { return 1 } if len(jobs) > 1 { - if jobID != jobs[0].ID { - c.Ui.Error(fmt.Sprintf("Prefix matched multiple jobs\n\n%s", createStatusListOutput(jobs, c.allNamespaces()))) - return 1 - } - if c.allNamespaces() && jobs[0].ID == jobs[1].ID { + if (jobID != jobs[0].ID) || (c.allNamespaces() && jobs[0].ID == jobs[1].ID) { c.Ui.Error(fmt.Sprintf("Prefix matched multiple jobs\n\n%s", createStatusListOutput(jobs, c.allNamespaces()))) return 1 }