Closed as not planned
Description
What is the problem this feature will solve?
I'm building a CLI that creates some instances by id and name. But I have to check if all options are filled by the user one by one.
const args = process.argv.slice(2)
const result = parseArgs({
args,
options: {
owner: {
type: 'string'
},
repo: {
type: 'string'
}
}
})
// imaging you will have tens of options in your CLI
if (result.values.repo == null || result.values.owner == null) {
throw new Error('require parameters')
}
./build.js --owner=himself65 --repo=xxx
What is the feature you are proposing to solve the problem?
Add required
option.
parseArgs({
args,
options: {
owner: {
type: 'string',
required: true
},
repo: {
type: 'string',
required: true
},
force: {
type: 'boolean',
// by default, required is false
},
}
})
What alternatives have you considered?
No response