MCPcopy Create free account
hub / github.com/Snapchat/Valdi / getUserChoice

Function getUserChoice

npm_modules/cli/src/utils/cliUtils.ts:70–87  ·  view source on GitHub ↗
(
  choices: Array<CliChoice<T> | Separator>,
  promptMessage?: string,
  maxChoices?: number,
)

Source from the content-addressed store, hash-verified

68}
69
70export async function getUserChoice<T>(
71 choices: Array<CliChoice<T> | Separator>,
72 promptMessage?: string,
73 maxChoices?: number,
74): Promise<T> {
75 const answers = await inquirer.prompt<{ selectedChoice: T }>([
76 {
77 type: 'list',
78 name: 'selectedChoice',
79 message: promptMessage ?? 'Please select an option:',
80 choices: choices,
81 loop: false,
82 pageSize: maxChoices ?? 10,
83 },
84 ]);
85
86 return answers.selectedChoice;
87}
88
89export async function getUserConfirmation(promptMessage?: string, defaultConfirm: boolean = false): Promise<boolean> {
90 const answer = await inquirer.prompt<{ confirm: boolean }>([

Callers 11

resolveContextIdFunction · 0.90
resolveClientIdFunction · 0.90
selectBazelTargetFunction · 0.90
getOutputFilePathFunction · 0.90
getDeviceChoiceFunction · 0.90
valdiNewModuleFunction · 0.90
valdiHotreloadFunction · 0.90
getApplicationTypeFunction · 0.90
showValdiLogsFunction · 0.90
inspectSelectFunction · 0.90
profileCaptureFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected