The order of .node_repl_history should be reversedΒ #3928
Description
Activity
- addedreplIssues and PRs related to the REPL subsystem.Issues and PRs related to the REPL subsystem.feature requestIssues requesting new Node.js features.Issues requesting new Node.js features.
on Nov 19, 2015 cc @chrisdickinson?
The reason is because that is the order
readlineuses: [1], [2]I can pick this up if it's identified as an issue that needs a fix @Fishrock123 @Vhin @chrisdickinson.
Can it even be done in a backwards-compatible way?
No, I think that would be semver-major. I won't object to seeing if it's reasonable for v6 though.
I have gotten the code working for this. Working on getting the tests to pass. Could use some help on 'em. Could I open a PR with incomplete code and ask for help there @Fishrock123 & @silverwind ?
@zeusdeux sure, go ahead. :)
- added a commit that references this issue
on Dec 16, 2015 @Fishrock123 Open here -> #4313 :)
While I wouldn't oppose the change, this does seem like an implementation detail that should not affect users. I'm going to close this issue. However, if someone feels that is a mistake, by all means, re-open or comment.
Just use following command:
tail -r -n $(cat ~/.node_repl_history | wc -l) ~/.node_repl_history
Then the output is display in the right (reversed) order.
you could define an alias or make a function out of it
Currently, .node_repl_history keeps the newest history at the top of the file, and the oldest at the bottom. This is contrary to essentially every other program that uses a similar history file.
.zsh_history, .bash_history, .python_history, .mysql_history, along with many others, all store the oldest at the top and newest commands at the bottom. Presumably, this is done because you can simply append to the file.
Other than node itself, the number of programs that rely on .node_repl_history having the newest at the top is very small, so it's unlikely this change would be problematic.