small history / 史
A tiny program to add the time and place to your shell history.\ This also enables you to copy a command to the clipboard.
You must have sqlite installed.
cargo install shi_history
, or
git clone https://git.sr.ht/~kyoheiu/shi
cd shi
cargo install --path .
And add the preexec hook to your shell config file.
For bash:
(bash-preexec required. See https://github.com/rcaloras/bash-preexec)
bash
source ~/.bash-preexec.sh
preexec() { shi --insert "$@"; }
For zsh or fish, you can use preexec hook.
If you'd like to copy a command to the clipboard, set any clipboard utility such
as xclip
or wl-copy
as $SHI_CLIP
.
At the first launch, shi
creates sqlite database in
$XDG_DATA_HOME/shi/.history
(on Linux, in most case it should be
~/.local/share/shi/.history
).
``` shi [ROWS] Print executed commands and time. (Default: 50 rows)
Options:
-a, --all Print all the history with the directory path where the command was executed
-i, --insert $XDG_DATA_HOME/shi/history.csv
--drop Drop the database table: Deleting all history
```