MCPcopy
hub / github.com/qawolf/cli / createConfirm

Function createConfirm

src/shell/ui/renderers/confirm.ts:18–30  ·  view source on GitHub ↗
({ mode, clack }: ConfirmDeps)

Source from the content-addressed store, hash-verified

16) => Promise<PromptResult<boolean>>;
17
18export function createConfirm({ mode, clack }: ConfirmDeps): ConfirmFn {
19 return async (message, opts) => {
20 if (opts?.yes) return { ok: true, value: true };
21 assertHumanMode(mode, "confirm");
22
23 // Destructive prompts start the cursor on No so a stray Enter is safe.
24 const value = await clack.confirm(
25 opts?.destructive ? { message, initialValue: false } : { message },
26 );
27 if (clack.isCancel(value)) return { ok: false };
28 return { ok: true, value };
29 };
30}

Callers 2

createUIFunction · 0.85
confirm.test.tsFile · 0.85

Calls 1

assertHumanModeFunction · 0.85

Tested by

no test coverage detected