Skip to content

Commit c8ad8a7

Browse files
committed
optionDefinition.output() is now invoked every time to give it a chance to set a default
1 parent 0f2310c commit c8ad8a7

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

index.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ class CommandLineArgs {
3737
} else {
3838
throw new Error('Extractor not found: ' + def.extractor)
3939
}
40-
if (extraction.length) {
41-
result[def.name] = await def.output(extraction)
42-
}
40+
result[def.name] = await def.output(extraction)
4341
}
4442

4543
/* Do the positionals backwards, so removing them doesn't mess up the position config */
@@ -50,9 +48,7 @@ class CommandLineArgs {
5048
for (const def of positionals) {
5149
def.output ||= defaultOutput
5250
const extraction = positional(this.argv, def.position - 1, { remove: true })
53-
if (extraction.length) {
54-
result[def.name] = await def.output(extraction)
55-
}
51+
result[def.name] = await def.output(extraction)
5652
}
5753
}
5854

0 commit comments

Comments
 (0)