Skip to content

Commit

Permalink
Fixes providing value for required option. Closes pnp#6518
Browse files Browse the repository at this point in the history
  • Loading branch information
waldekmastykarz committed Dec 14, 2024
1 parent 9e186e5 commit 8351ef2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/cli/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,12 @@ async function execute(rawArgs: string[]): Promise<void> {
await cli.error('🌶️ Provide values for the following parameters:');

for (const error of result.error.errors) {
const optionInfo = cli.commandToExecute!.options.find(o => o.name === error.path.join('.'));
const optionName = error.path.join('.');
const optionInfo = cli.commandToExecute.options.find(o => o.name === optionName);
const answer = await cli.promptForValue(optionInfo!);
cli.optionsFromArgs!.options[error.path.join('.')] = answer;
// coerce the answer to the correct type
const parsed = getCommandOptionsFromArgs([`--${optionName}`, answer], cli.commandToExecute);
cli.optionsFromArgs.options[optionName] = parsed[optionName];
}
}
else {
Expand Down

0 comments on commit 8351ef2

Please sign in to comment.