MCPcopy
hub / github.com/MiniMax-AI/cli / promptOrFail

Function promptOrFail

src/utils/prompt.ts:76–96  ·  view source on GitHub ↗
(opts: {
  value: string | undefined;
  message: string;
  cancelMessage: string;
  flagName: string;
  usageHint: string;
  nonInteractive?: boolean;
})

Source from the content-addressed store, hash-verified

74}
75
76export async function promptOrFail(opts: {
77 value: string | undefined;
78 message: string;
79 cancelMessage: string;
80 flagName: string;
81 usageHint: string;
82 nonInteractive?: boolean;
83}): Promise<string> {
84 if (opts.value) return opts.value;
85
86 if (isInteractive({ nonInteractive: opts.nonInteractive })) {
87 const hint = await promptText({ message: opts.message });
88 if (!hint) {
89 process.stderr.write(opts.cancelMessage + '\n');
90 process.exit(1);
91 }
92 return hint;
93 }
94
95 failIfMissing(opts.flagName, opts.usageHint);
96}

Callers 2

runFunction · 0.90
runFunction · 0.90

Calls 3

isInteractiveFunction · 0.85
promptTextFunction · 0.85
failIfMissingFunction · 0.85

Tested by

no test coverage detected