简体   繁体   English

如何正确清除 Node.js 中的终端历史记录

[英]How to properly clear terminal history in Node.js

I'm creating my own cli (for my use only) and I would like a method "clear" that works like macos' (or linux's) "reset" (tput reset) command.我正在创建我自己的 cli(仅供我使用),并且我想要一种类似于 macos(或 linux)的“reset”(tput reset)命令的“clear”方法。 Mainly the fact that it clears all text in the terminal even previous text that is outside of the terminal viewport.主要是因为它清除了终端中的所有文本,甚至是终端视口之外的先前文本。 Any Ideas?有任何想法吗?

I've tried child_process' exec() and I've tried methods that "clear" all and move the cursor to 0,0.我试过 child_process' exec()并且我试过“清除”所有并将光标移动到 0,0 的方法。 But neither of these do what I want.但这些都不是我想要的。

您可以通过此命令清除 bash shell 历史记录。

history -c && history -w

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM