我工作的一個簡單的CLI腳本,想一些顏色添加到下面的代碼:添加顏色,在白色大空間的終端提示結果
rl.question('Enter destination path: ', function(answer) {
// ...
});
rl.write('/home/' + user + '/bin');
該款顯示器在終端:
Enter destination path: /home/jmcateer/bin_
但我想一些顏色添加到提示我做了以下內容:
rl.question('\u001b[1;36mEnter destination path:\u001b[0m ', function(answer) {
});
rl.write('/home/' + user + '/bin');
而且comman d行提示最後顯示:
Enter destination path: /home/jmcateer/bin_
它的工作原理,但有大量的空白,我寧願不在那裏。有沒有人有任何想法如何處理這個?
編輯:
我無法通過它退格鍵刪除空白......當我嘗試使用退格鍵的白色空間跳轉到另一端,像這樣
Enter destination path: /home/jmcateer/bin_
Enter destination path: /home/jmcateer/bi _
Enter destination path: /home/jmcateer/b _
...
Enter destination path: _
此時退格不起作用。
沒有喜悅它沒有任何效果,它不會出現是正常的字符,請看到我的編輯 – JaredMcAteer