Rich Enhanced Shell History - Contextual shell history for zsh and bash
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
Simon Let acbf463942 Return the warning for new installs, cosmetic fixes 3 years ago
.github/workflows use record.V1 more, housekeeping 3 years ago
cmd Simplify shell hooks 3 years ago
conf change config, remove data 3 years ago
img update readme, install info, error mesages, minor fix, minor score tweak 6 years ago
internal Simplify shell hooks 3 years ago
record better errors 3 years ago
scripts Return the warning for new installs, cosmetic fixes 3 years ago
submodules update submodule 6 years ago
.gitignore add vscode files to gitignore 6 years ago
.gitmodules minor fixes 6 years ago
.goreleaser.yml Use Go binary to get epochtime 3 years ago
LICENSE Create LICENSE 7 years ago
Makefile Simplify shell hooks 3 years ago
README.md update reshctl version to use output package 3 years ago
go.mod Simplify shell hooks 3 years ago
go.sum Finish up and use device ID and name. Changes. 3 years ago
roadmap.md remove recall 3 years ago

README.md

GitHub tag (latest SemVer) Go test Shell test

Rich Enhanced Shell History

Context-based replacement/enhancement for zsh and bash shell history

Search your history by commands or arguments and get relevant results based on current directory, git repo, exit status, and device.

Installation

Prerequisites

Nohup

Standard stuff: bash(4.3+), curl, tar, ...

MacOS: coreutils (brew install coreutils)

Simplest installation

Run this command.

curl -fsSL https://raw.githubusercontent.com/curusarn/resh/master/scripts/rawinstall.sh | bash

Simple installation

Run

git clone https://github.com/curusarn/resh.git
cd resh && scripts/rawinstall.sh

Update

Check for updates and update

reshctl update

Roadmap

Overview of the features of the project

RESH SEARCH application

This is the most important part of this project.

RESH SEARCH app searches your history by commands. It uses device, directories, git remote, and exit status to show you relevant results first.

All this context is not in the regular shell history. RESH records shell history with context to use it when searching.

At first, the search application will look something like this. Some history with context and most of it without. As you can see, you can still search the history just fine.

resh search app

Eventually most of your history will have context and RESH SEARCH app will get more useful.

resh search app

Without a query, RESH SEARCH app shows you the latest history based on the current context (device, directory, git).

resh search app

RESH SEARCH app replaces the standard reverse search - launch it using Ctrl+R.

Enable/disable the Ctrl+R keybinding:

reshctl enable ctrl_r_binding
reshctl disable ctrl_r_binding

In-app key bindings

  • Type to search/filter
  • Up/Down or Ctrl+P/Ctrl+N to select results
  • Right to paste selected command onto the command line so you can edit it before execution
  • Enter to execute
  • Ctrl+C/Ctrl+D to quit
  • Ctrl+G to abort and paste the current query onto the command line
  • Ctrl+R to switch between RAW and NORMAL mode

View the recorded history

FIXME: redo/update this section

Resh history is saved to: ~/.resh_history.json

Each line is a versioned JSON that represents one executed command line.

This is how I view it tail -f ~/.resh_history.json | jq or jq < ~/.resh_history.json.

You can install jq using your favorite package manager or you can use other JSON parser to view the history.

screenshot

Recorded metadata will be reduced to only include useful information in the future.

Known issues

Q: I use bash on macOS and resh doesn't work

A: Add line [ -f ~/.bashrc ] && . ~/.bashrc to your ~/.bash_profile.

Long Answer: Under macOS bash shell only loads ~/.bash_profile because every shell runs as login shell.

Issues and ideas

Please do create issues if you encounter any problems or if you have suggestions: https://github.com/curusarn/resh/issues

Uninstallation

You can uninstall this project at any time by running rm -rf ~/.resh/.

You won't lose any recorded history by removing ~/.resh directory because history is saved in ~/.resh_history.json.