Skip to content

The order of .node_repl_history should be reversedΒ #3928

Description

@Zeturic

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.

Activity

  1. added
    replIssues and PRs related to the REPL subsystem.
    feature requestIssues requesting new Node.js features.
    on Nov 19, 2015
  2. Fishrock123 commented on Nov 20, 2015

    @Fishrock123
    Contributor

    cc @chrisdickinson?

    The reason is because that is the order readline uses: [1], [2]

  3. zeusdeux commented on Nov 25, 2015

    @zeusdeux
    Contributor

    I can pick this up if it's identified as an issue that needs a fix @Fishrock123 @Vhin @chrisdickinson.

  4. silverwind commented on Nov 27, 2015

    @silverwind
    Contributor

    Can it even be done in a backwards-compatible way?

  5. Fishrock123 commented on Nov 30, 2015

    @Fishrock123
    Contributor

    No, I think that would be semver-major. I won't object to seeing if it's reasonable for v6 though.

  6. zeusdeux commented on Dec 7, 2015

    @zeusdeux
    Contributor

    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 ?

  7. Fishrock123 commented on Dec 11, 2015

    @Fishrock123
    Contributor

    @zeusdeux sure, go ahead. :)

  8. zeusdeux commented on Dec 16, 2015

    @zeusdeux
    Contributor

    @Fishrock123 Open here -> #4313 :)

  9. Trott commented on Jun 8, 2016

    @Trott
    Member

    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.

  10. bambam2174 commented on Aug 30, 2018

    @bambam2174

    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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues requesting new Node.js features.replIssues and PRs related to the REPL subsystem.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions