Skip to content

Commit

Permalink
cli: pipeline remove error if no jobs (#552)
Browse files Browse the repository at this point in the history
  • Loading branch information
FeelyChau authored Sep 3, 2020
1 parent e83f220 commit 010a9c4
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions packages/cli/src/bin/pipcook-pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,20 @@ program
}
const jobs = await listJobsByPipelineId(id, opts);
let confirm = !!opts.yes;
if (!opts.yes && jobs.length > 0) {
const answer = await prompt([
{
type: 'confirm',
name: 'remove',
message: `${jobs.length} ${jobs.length > 1 ? 'jobs' : 'job'} which belong to the pipeline will be removed too, continue?`,
default: false
}
]);
confirm = answer.remove;
if (!opts.yes) {
if (jobs.length > 0) {
const answer = await prompt([
{
type: 'confirm',
name: 'remove',
message: `${jobs.length} ${jobs.length > 1 ? 'jobs' : 'job'} which belong to the pipeline will be removed too, continue?`,
default: false
}
]);
confirm = answer.remove;
} else {
confirm = true;
}
}
if (confirm) {
return remove(id, jobs, opts);
Expand Down

0 comments on commit 010a9c4

Please sign in to comment.