MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / confirm

Function confirm

src/setup/prompt.ts:17–27  ·  view source on GitHub ↗
(
  question: string,
  defaultYes: boolean,
  opts: PromptOptions,
)

Source from the content-addressed store, hash-verified

15
16/** Yes/no prompt. Default is the answer used in non-interactive mode and on bare Enter. */
17export async function confirm(
18 question: string,
19 defaultYes: boolean,
20 opts: PromptOptions,
21): Promise<boolean> {
22 if (!opts.interactive) return defaultYes;
23 const hint = defaultYes ? '[Y/n]' : '[y/N]';
24 const ans = (await readLine(`${question} ${hint} `)).trim().toLowerCase();
25 if (ans === '') return defaultYes;
26 return ans === 'y' || ans === 'yes';
27}
28
29/** Resolve the starting index for a select list from its default value. Pure → testable. */
30export function initialIndex<T extends string>(

Callers 2

interactiveAddProviderFunction · 0.85
runSetupFunction · 0.85

Calls 1

readLineFunction · 0.85

Tested by

no test coverage detected