repl: add .clearhistory command - #64450
Conversation
|
This feels a bit off to me. The functionality makes sense, I could see wanting this. But I'm not sure if it's clear when I'd want this vs |
|
@bnb good call. A few options:
I lean toward |
|
@bnb This functionality will help users to remove commands/contents from previous sessions if they are trying to use same variables or functions with different purpose in subsequent new sessions. Without this functionality user will have to delete/clear contents of the history file to achieve the same. I would also agree that the name can be changed since it is quite similar to that of |
24d84c5 to
a2f8677
Compare
|
Went with |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #64450 +/- ##
==========================================
+ Coverage 90.09% 90.12% +0.02%
==========================================
Files 752 752
Lines 252335 252358 +23
Branches 47461 47448 -13
==========================================
+ Hits 227353 227443 +90
+ Misses 16266 16213 -53
+ Partials 8716 8702 -14
🚀 New features to boost your workflow:
|
|
Hey @bnb, circling back on this. I reworked it to |
Add a `.history` REPL command with a `clear` subcommand that clears the in-memory session history and truncates the persisted history file when one is configured. Any pending debounced flush is cancelled first so it cannot rewrite the file after it has been cleared. Fixes: nodejs#63905 Signed-off-by: Paul Bouchon <mail@bitpshr.net>
a2f8677 to
69c9188
Compare
This pull request adds a
.clearhistoryREPL command that clears the current session history, both in memory and in the persistent history file when one is configured.It clears the in-memory history array, resets the navigation index, and truncates the backing file through the open handle. Any pending debounced flush is cancelled first so it cannot rewrite the file after it has been cleared.
Fixes: #63905