MCPcopy
hub / github.com/vudovn/ag-kit / confirm

Function confirm

cli/bin/index.js:42–65  ·  view source on GitHub ↗
(question)

Source from the content-addressed store, hash-verified

40};
41
42const confirm = (question) => {
43 const rl = readline.createInterface({
44 input: process.stdin,
45 output: process.stdout,
46 });
47
48 return new Promise((resolve) => {
49 rl.on("SIGINT", async () => {
50 rl.close();
51 console.log(chalk.gray("\nOperation aborted by user."));
52 const tempDir = path.join(path.resolve(process.cwd()), TEMP_FOLDER);
53 if (await fse.pathExists(tempDir)) {
54 await fse.remove(tempDir);
55 }
56 process.exit(0);
57 });
58
59 rl.question(chalk.yellow(`? ${question} (y/N) `), (answer) => {
60 rl.close();
61 const val = answer.trim().toLowerCase();
62 resolve(val === "y" || val === "yes");
63 });
64 });
65};
66
67const checkUpdate = async (quiet = false) => {
68 if (quiet) return null;

Callers 2

initCommandFunction · 0.85
updateCommandFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected