Currently, Node.js is checking that arg has the correct type (by the strict option).
By I need manually check that this arg was provided by user. How about boolean flag required for this?
Before:
const { values } = parseArgs({
options: {
param: { type: 'string', short: 'p' },
},
})
if (!values.param) {
console.error('The "--param" param is required!')
process.exit(1)
}
After:
const { values } = parseArgs({
options: {
param: { type: 'string', short: 'p', required: true },
},
})
Currently, Node.js is checking that arg has the correct type (by the
strictoption).By I need manually check that this arg was provided by user. How about boolean flag
requiredfor this?Before:
After: