-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
Closed as not planned
Labels
feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.staleutilIssues and PRs related to the built-in util module.Issues and PRs related to the built-in util module.
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
sindresorhus, ErickWendel, jalooc, andriyor, kevcodez and 7 more
Metadata
Metadata
Assignees
Labels
feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.staleutilIssues and PRs related to the built-in util module.Issues and PRs related to the built-in util module.