from Hacker News

RESH: Rich Enhanced Shell History

by hxelk1 on 5/16/22, 5:20 PM with 22 comments

  • by phiresky on 5/16/22, 7:21 PM

    Alternatives (without judgement):

    https://github.com/cantino/mcfly

    https://github.com/jcsalterego/historian

    https://github.com/larkery/zsh-histdb + https://github.com/m42e/zsh-histdb-fzf

    https://github.com/ellie/atuin

    All of these except the OP (I think) use SQLite databases.

    Personally I use zsh-histdb, which is great but only for ZSH. I'm working on adding a rich SQLite history to nushell so I can finally try nu: https://github.com/nushell/reedline/pull/401 .

  • by foobarian on 5/16/22, 9:42 PM

    I use a homerolled thing in .bashrc using plain text files. Regardless of implementation details, this kind of thing saved me vast amount of time over the years. Some requirements that I find the most useful:

    - Session ID: assign session IDs so multiple shells don't get mixed up. Make customizable so it's easy to integrate with screen or tmux etc. On reboot, if session IDs are restored, the history can be recovered.

    - Instant write: command typed in one shell should be available to search in a different shell right away

    - Search order: reverse search should return commands for the current session first, but also make other sessions available

  • by cmer on 5/16/22, 7:14 PM

    Been using something similar, McFly, for a while. It works really well. https://github.com/cantino/mcfly
  • by ape4 on 5/16/22, 7:05 PM

    My favorite shell keystroke saver now is tab-completion. Its wonderful that it works for things besides files. eg `systemctl iso<tab>` gives 'systemctl isolate`

    Its great but it could be even better. For example if there is ambiguity the possible choices are shown but not as a menu.

  • by smartmic on 5/16/22, 6:50 PM

    The example shows many fields which are stored in the JSON for each command. I wonder how the file size will blow up after some time. Also, how are duplicates handled? Looking at all the details which are kept in context of a command, removing duplicate commands seems not to be an option without loosing the rich context.
  • by devnonymous on 5/17/22, 5:35 AM

    Not directly related, but for a long time now, I've been using per project specific $HISTFILE (set automatically when I start using, ie: cd into, the project dir) and that simple change, by itself, has greatly improved the quality of the cli history.
  • by pepemon on 5/16/22, 6:44 PM

    Is there something similar available for fish?
  • by tcoff91 on 5/16/22, 7:05 PM

    This looks interesting, I'll have to try this and see how I like it compared to fzf's fuzzy history search.