fleetbo-cockpit-cli 1.0.122 → 1.0.123
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/cli.js +13 -22
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -641,21 +641,9 @@ if (command === 'alex') {
|
|
|
641
641
|
|
|
642
642
|
let inputBuffer = "";
|
|
643
643
|
let isProcessing = false;
|
|
644
|
-
let
|
|
645
|
-
let submitTimer = null; // soumet après ligne vide si buffer non vide
|
|
646
|
-
|
|
647
|
-
const showHint = () => {
|
|
648
|
-
if (hintTimer) { clearTimeout(hintTimer); hintTimer = null; }
|
|
649
|
-
hintTimer = setTimeout(() => {
|
|
650
|
-
if (inputBuffer.trim() !== "" && !isProcessing) {
|
|
651
|
-
rl.setPrompt("\x1b[90m ↵ again to send\x1b[0m");
|
|
652
|
-
rl.prompt();
|
|
653
|
-
}
|
|
654
|
-
}, 1500);
|
|
655
|
-
};
|
|
644
|
+
let submitTimer = null;
|
|
656
645
|
|
|
657
646
|
const doSubmit = async () => {
|
|
658
|
-
if (hintTimer) { clearTimeout(hintTimer); hintTimer = null; }
|
|
659
647
|
if (submitTimer) { clearTimeout(submitTimer); submitTimer = null; }
|
|
660
648
|
if (isProcessing || inputBuffer.trim() === "") return;
|
|
661
649
|
|
|
@@ -691,20 +679,23 @@ if (command === 'alex') {
|
|
|
691
679
|
}
|
|
692
680
|
|
|
693
681
|
if (trimmedLine !== "") {
|
|
694
|
-
// Annule
|
|
682
|
+
// Annule le submitTimer si une ligne non-vide arrive après une ligne vide
|
|
683
|
+
// (cas d'un paste avec lignes vides internes)
|
|
695
684
|
if (submitTimer) { clearTimeout(submitTimer); submitTimer = null; }
|
|
696
685
|
inputBuffer += (inputBuffer ? "\n" : "") + line;
|
|
697
|
-
//
|
|
698
|
-
// Si d'autres lignes arrivent avant (paste), le timer se remet à zéro
|
|
699
|
-
showHint();
|
|
686
|
+
// Pas de hint ici — le hint s'affiche uniquement sur ligne vide explicite
|
|
700
687
|
} else {
|
|
701
|
-
// Ligne vide : soumet si buffer non vide, sinon prompt
|
|
702
688
|
if (inputBuffer.trim() !== "") {
|
|
703
|
-
//
|
|
704
|
-
//
|
|
705
|
-
submitTimer
|
|
689
|
+
// Ligne vide reçue — peut venir d'un paste ou d'une frappe manuelle.
|
|
690
|
+
// On attend 400ms : si d'autres lignes non-vides arrivent (paste en cours),
|
|
691
|
+
// le submitTimer est annulé. Sinon on affiche le hint.
|
|
692
|
+
if (submitTimer) clearTimeout(submitTimer);
|
|
693
|
+
submitTimer = setTimeout(() => {
|
|
694
|
+
submitTimer = null;
|
|
695
|
+
rl.setPrompt("\x1b[90m ↵ again to send\x1b[0m");
|
|
696
|
+
rl.prompt();
|
|
697
|
+
}, 400);
|
|
706
698
|
} else {
|
|
707
|
-
if (hintTimer) { clearTimeout(hintTimer); hintTimer = null; }
|
|
708
699
|
rl.setPrompt(`\x1b[34m${dynamicUsername} ❯ \x1b[0m`);
|
|
709
700
|
rl.prompt();
|
|
710
701
|
}
|