Return error if both jobID and runID are specified
This commit is contained in:
parent
3645975da7
commit
24ec53365b
2 changed files with 5 additions and 11 deletions
|
|
@ -50,11 +50,7 @@ func NewCmdRerun(f *cmdutil.Factory, runF func(*RerunOptions) error) *cobra.Comm
|
|||
}
|
||||
|
||||
if opts.RunID != "" && opts.JobID != "" {
|
||||
opts.RunID = ""
|
||||
if opts.IO.CanPrompt() {
|
||||
cs := opts.IO.ColorScheme()
|
||||
fmt.Fprintf(opts.IO.ErrOut, "%s both run and job IDs specified; ignoring run ID\n", cs.WarningIcon())
|
||||
}
|
||||
return cmdutil.FlagErrorf("specify only one of <run-id> or <job-id>")
|
||||
}
|
||||
|
||||
if runF != nil {
|
||||
|
|
|
|||
|
|
@ -76,12 +76,10 @@ func TestNewCmdRerun(t *testing.T) {
|
|||
},
|
||||
},
|
||||
{
|
||||
name: "with args job and runID ignores runID",
|
||||
tty: true,
|
||||
cli: "1234 --job 5678",
|
||||
wants: RerunOptions{
|
||||
JobID: "5678",
|
||||
},
|
||||
name: "with args jobID and runID fails",
|
||||
tty: true,
|
||||
cli: "1234 --job 5678",
|
||||
wantsErr: true,
|
||||
},
|
||||
{
|
||||
name: "with arg job with no ID fails",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue