mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-07 12:11:24 +00:00
chore: format to 2-space and bump changelog
This commit is contained in:
@@ -4,18 +4,18 @@ import readline from "node:readline/promises";
|
||||
import { isVerbose, isYes } from "../globals.js";
|
||||
|
||||
export async function promptYesNo(
|
||||
question: string,
|
||||
defaultYes = false,
|
||||
question: string,
|
||||
defaultYes = false,
|
||||
): Promise<boolean> {
|
||||
// Simple Y/N prompt honoring global --yes and verbosity flags.
|
||||
if (isVerbose() && isYes()) return true; // redundant guard when both flags set
|
||||
if (isYes()) return true;
|
||||
const rl = readline.createInterface({ input, output });
|
||||
const suffix = defaultYes ? " [Y/n] " : " [y/N] ";
|
||||
const answer = (await rl.question(`${question}${suffix}`))
|
||||
.trim()
|
||||
.toLowerCase();
|
||||
rl.close();
|
||||
if (!answer) return defaultYes;
|
||||
return answer.startsWith("y");
|
||||
// Simple Y/N prompt honoring global --yes and verbosity flags.
|
||||
if (isVerbose() && isYes()) return true; // redundant guard when both flags set
|
||||
if (isYes()) return true;
|
||||
const rl = readline.createInterface({ input, output });
|
||||
const suffix = defaultYes ? " [Y/n] " : " [y/N] ";
|
||||
const answer = (await rl.question(`${question}${suffix}`))
|
||||
.trim()
|
||||
.toLowerCase();
|
||||
rl.close();
|
||||
if (!answer) return defaultYes;
|
||||
return answer.startsWith("y");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user