To unify your fish shell history:
- Install
plentyson the host of your choice. - Install
plentyon your machines. - Run
plenty <host>periodically on your machines.
Simple tools in Rust, communicating over SSH in a binary protocol (TLV).
plenty is the client, invoked with plenty <host>.
plentys is the server, invoked by the client through ssh <host> plentys.
- Create
.local/share/plentyon the server if it doesn't exist. - Create
.local/share/plenty/history.dbon the server if it doesn't exist, with the following schema:
"CREATE TABLE IF NOT EXISTS history (
cmd TEXT,
"when" INTEGER,
extra TEXT
)
CREATE UNIQUE INDEX IF NOT EXISTS idx_history_unique
ON history("when", cmd, extra)- Take a lock on
~/local/share/fishusingflock(LOCK_SH|LOCK_EX)on the client. - Read
~/.local/share/fish/fish_historyon the client. INSERT OR IGNORE INTO historyon the server.- Select the full history on the server
ORDER BY "when", send it to the client. - Write it to
~/.local/share/fish/fish_historyon the client. - Release the lock on the client.