MCPcopy Index your code
hub / github.com/MiniMax-AI/cli / promptText

Function promptText

src/utils/prompt.ts:25–43  ·  view source on GitHub ↗
(options: {
  message: string;
  defaultValue?: string;
})

Source from the content-addressed store, hash-verified

23 * undefined immediately so the caller can fail fast.
24 */
25export async function promptText(options: {
26 message: string;
27 defaultValue?: string;
28}): Promise<string | undefined> {
29 if (!isInteractive()) return undefined;
30
31 const { defaultValue, message } = options;
32 const inquirer = await import('@clack/prompts');
33 // eslint-disable-next-line @typescript-eslint/no-explicit-any
34 const val = await (inquirer as any).text({
35 message,
36 default: defaultValue,
37 placeholder: defaultValue,
38 });
39
40 // @clack/prompts returns a Symbol.cancel when the user presses Ctrl+C
41 if (typeof val === 'symbol') return undefined;
42 return val as string;
43}
44
45/**
46 * Like promptText but confirms with y/N before proceeding.

Callers 6

ensureAuthFunction · 0.90
runFunction · 0.90
runFunction · 0.90
runFunction · 0.90
runFunction · 0.90
promptOrFailFunction · 0.85

Calls 1

isInteractiveFunction · 0.85

Tested by

no test coverage detected