Skip to content

Commit

Permalink
fix: handle required: false for positional arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Jul 5, 2023
1 parent 188d60c commit ab0401b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/args.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export function parseArgs<T extends ArgsDef = ArgsDef>(
const nextPositionalArgument = positionalArguments.shift();
if (nextPositionalArgument !== undefined) {
parsedArgsProxy[arg.name] = nextPositionalArgument;
} else if (arg.default === undefined) {
} else if (arg.default === undefined && arg.required !== false) {
throw new CLIError(
`Missing required positional argument: ${arg.name.toUpperCase()}`,
"EARG",
Expand Down

0 comments on commit ab0401b

Please sign in to comment.