I have this command definition:
module.exports = {
command: 'ls [options]',
describe: 'List tags',
builder(yargs) {
yargs
.option('task', {
alias: 't',
describe: 'a task number',
type: 'string',
requiresArg: true
})
.coerce('task', arg => {
console.log('AAA: ', arg)
return arg
})
.showHelpOnFail(true)
},
async handler(argv) {
...
}
}
But when option --task is not provided, the coerce function is not called. Is it really the expected behaviour? Shouldn't the function be called with undefined nonetheless?
I have this command definition:
But when option
--taskis not provided, thecoercefunction is not called. Is it really the expected behaviour? Shouldn't the function be called withundefinednonetheless?