repowisestage 0.0.31 → 0.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/repowise.js +13 -13
- package/package.json +1 -1
package/dist/bin/repowise.js
CHANGED
|
@@ -2536,22 +2536,27 @@ function multilineInput() {
|
|
|
2536
2536
|
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
2537
2537
|
const lines = [];
|
|
2538
2538
|
let lastLineTime = 0;
|
|
2539
|
+
let resolved = false;
|
|
2540
|
+
const done = (value) => {
|
|
2541
|
+
if (resolved) return;
|
|
2542
|
+
resolved = true;
|
|
2543
|
+
rl.close();
|
|
2544
|
+
resolve(value);
|
|
2545
|
+
};
|
|
2539
2546
|
rl.setPrompt(" > ");
|
|
2540
2547
|
rl.prompt();
|
|
2541
2548
|
rl.on("line", (line) => {
|
|
2542
2549
|
const now = Date.now();
|
|
2543
2550
|
const elapsed = now - lastLineTime;
|
|
2544
2551
|
lastLineTime = now;
|
|
2545
|
-
const
|
|
2546
|
-
if (
|
|
2547
|
-
|
|
2548
|
-
resolve(trimmed);
|
|
2552
|
+
const lower = line.trim().toLowerCase();
|
|
2553
|
+
if (lower === "done" || lower === "skip") {
|
|
2554
|
+
done(lower);
|
|
2549
2555
|
return;
|
|
2550
2556
|
}
|
|
2551
2557
|
if (lines.length === 0) {
|
|
2552
2558
|
if (line === "") {
|
|
2553
|
-
|
|
2554
|
-
resolve("");
|
|
2559
|
+
done("");
|
|
2555
2560
|
return;
|
|
2556
2561
|
}
|
|
2557
2562
|
lines.push(line);
|
|
@@ -2560,8 +2565,7 @@ function multilineInput() {
|
|
|
2560
2565
|
return;
|
|
2561
2566
|
}
|
|
2562
2567
|
if (elapsed > 50 && line === "") {
|
|
2563
|
-
|
|
2564
|
-
resolve(lines.join("\n").trim());
|
|
2568
|
+
done(lines.join("\n").trim());
|
|
2565
2569
|
return;
|
|
2566
2570
|
}
|
|
2567
2571
|
lines.push(line);
|
|
@@ -2569,11 +2573,7 @@ function multilineInput() {
|
|
|
2569
2573
|
rl.prompt();
|
|
2570
2574
|
});
|
|
2571
2575
|
rl.on("close", () => {
|
|
2572
|
-
|
|
2573
|
-
resolve(lines.join("\n").trim());
|
|
2574
|
-
} else {
|
|
2575
|
-
resolve("");
|
|
2576
|
-
}
|
|
2576
|
+
done(lines.length > 0 ? lines.join("\n").trim() : "");
|
|
2577
2577
|
});
|
|
2578
2578
|
rl.on("error", reject);
|
|
2579
2579
|
});
|