Есть ли способ получить командную строку (просто question
подсказка или что-то подобное), зафиксированное в нижней части терминала, и для вывода журнала над ним, используя Node.js.
Очень плохой пример:
Your favourite food is sushi.
Your favourite food is chicken.
Your favourite food is okra.
--> What is your favourite food?
Итак, по сути, я ищу, чтобы пользователь всегда мог вводить текст и вводил эхо в ответ над подсказкой.
interface.question("What is your favourite food?", function(answer) {
// output the answer above where this prompt was
// and somehow keep this same prompt where is is
});
Конкретное приложение, в котором я надеюсь использовать это, - это простой IRC-клиент, где у меня есть место для ввода пользователем и есть весь вывод (то, что пользователь набрал, и то, что другие также набрали) выведенный выше, где пользователь печатает. Строки на диаграмме ниже являются мнимыми.
----------------------------------------------------------------------
| |
| |
| |
| |
| |
| |
| |
| Stuff |
| Stuff |
| Stuff |
----------------------------------------------------------------------
| --> The user can type here |
----------------------------------------------------------------------