Skip to content

Commit

Permalink
#208 Added simple validation for ensuring that times and interval can…
Browse files Browse the repository at this point in the history
…not be negative values
  • Loading branch information
czprz committed May 18, 2023
1 parent 91d339c commit 42b417a
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions bin/execution/executor/executor-yargs-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,25 @@ export default new class {
alias: 't',
describe: 'Number of times to run action (0 - infinite)',
type: 'number',
default: 0
default: 0,
coerce: (value) => {
if (value < 0) {
throw new Error('Option --times, -t must be positive value');
}
return value;
}
})
.option('interval', {
alias: 'i',
describe: 'Interval between runs (seconds)',
type: 'number',
demandOption: true
demandOption: true,
coerce: (value) => {
if (value < 0) {
throw new Error('Option --interval, -i must be positive value');
}
return value;
}
});

customOptionsYargsCreator.addToYargs(yargs, segment.actions)
Expand Down

0 comments on commit 42b417a

Please sign in to comment.