Skip to content

Commit ab0401b

Browse files
committed
fix: handle required: false for positional arguments
1 parent 188d60c commit ab0401b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/args.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export function parseArgs<T extends ArgsDef = ArgsDef>(
4848
const nextPositionalArgument = positionalArguments.shift();
4949
if (nextPositionalArgument !== undefined) {
5050
parsedArgsProxy[arg.name] = nextPositionalArgument;
51-
} else if (arg.default === undefined) {
51+
} else if (arg.default === undefined && arg.required !== false) {
5252
throw new CLIError(
5353
`Missing required positional argument: ${arg.name.toUpperCase()}`,
5454
"EARG",

0 commit comments

Comments
 (0)