Skip to content

Commit 8351ef2

Browse files
Fixes providing value for required option. Closes #6518
1 parent 9e186e5 commit 8351ef2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/cli/cli.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,12 @@ async function execute(rawArgs: string[]): Promise<void> {
194194
await cli.error('🌶️ Provide values for the following parameters:');
195195

196196
for (const error of result.error.errors) {
197-
const optionInfo = cli.commandToExecute!.options.find(o => o.name === error.path.join('.'));
197+
const optionName = error.path.join('.');
198+
const optionInfo = cli.commandToExecute.options.find(o => o.name === optionName);
198199
const answer = await cli.promptForValue(optionInfo!);
199-
cli.optionsFromArgs!.options[error.path.join('.')] = answer;
200+
// coerce the answer to the correct type
201+
const parsed = getCommandOptionsFromArgs([`--${optionName}`, answer], cli.commandToExecute);
202+
cli.optionsFromArgs.options[optionName] = parsed[optionName];
200203
}
201204
}
202205
else {

0 commit comments

Comments
 (0)