-
Notifications
You must be signed in to change notification settings - Fork 55
Closed
Description
Would it make sense to support required arguments? For example:
const args = arg({
'--help': Boolean,
'--port': arg.req(Number),
'--name': String,
'--tag': arg.req([String]),
});
Alternatively:
const args = arg({
'--help': Boolean,
'--path': String,
});
const {
'--help': printHelp = false,
'--path': thePath = arg.required('--path', String),
} = args;
arg.required() would print an error message and exit Node.js. Downsides of this approach: Doesn’t handle aliases, redundancy.
If this is out of scope, it would be a good FAQ, because many shell argument parsing libraries support this feature.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels