stinkpot: sqlite-backed shell history
stinkpot: 基于 SQLite 的 Shell 历史记录工具
stinkpot
_ _ / \ _ (/_//) // /\ /_// /_/ ” ”
stinkpot is an sqlite backed shell-history searcher for bash. stinkpot is a much tinier atuin (https://atuin.sh). i have been using atuin for a while, but i don’t use most of its features: the sync server, atuin AI, dotfiles manager, script manager or the KV store. while sync is interesting, my machines have very different setups and i tend to run very different commands on them. my only usecase for atuin was the session agnostic history management, and the searcher TUI. stinkpot provides these while being about 400 lines of go. stinkpot is a tiny turtle species apparently, hence the name.
stinkpot 是一个基于 SQLite 的 Bash Shell 历史记录搜索工具。stinkpot 可以看作是一个极简版的 atuin (https://atuin.sh)。我使用 atuin 已经有一段时间了,但我并不使用它的大多数功能:比如同步服务器、atuin AI、配置文件管理器、脚本管理器或 KV 存储。虽然同步功能很有趣,但我的机器配置差异很大,而且我倾向于在不同机器上运行完全不同的命令。我使用 atuin 的唯一目的就是跨会话的历史记录管理以及它的搜索终端界面 (TUI)。stinkpot 提供了这些功能,且代码量仅约 400 行 Go 代码。stinkpot 似乎是一种小型海龟的名字,因此得名。
develop
to build: go build -o stinkpot .
开发
构建方法: go build -o stinkpot .
usage
if you use home-manager for nixos, stinkpot has a home-manager module:
home-manager.users.
if not, just call eval the init script in your .bashrc: eval ”$(stinkpot init)”
start by importing your existing bash history into stinkpot: stinkpot import
and then hit ctrl+r at your shell to trigger reverse search:
search history… 1s vim flake.nix 3m redis-server 3m jj l 35m jj show m 36m jj git fetch 39m cd 40m vim readme.txt 788 matches · ↑/↓ move · enter accept · esc cancel
hit tab/enter to accept the selection, hit enter again to execute. the history database is stored in ~/.local/share/stinkpot. if upgrades break the DB, just delete it and run the import command.
使用方法
如果你在 NixOS 上使用 home-manager,stinkpot 提供了相应的模块:
home-manager.users.
如果不是,只需在你的 .bashrc 中调用初始化脚本: eval ”$(stinkpot init)”
首先将你现有的 bash 历史记录导入到 stinkpot 中: stinkpot import
然后在 shell 中按下 ctrl+r 触发反向搜索:
search history… 1s vim flake.nix 3m redis-server 3m jj l 35m jj show m 36m jj git fetch 39m cd 40m vim readme.txt 788 matches · ↑/↓ 移动 · enter 确认 · esc 取消
按 tab 或 enter 键选中条目,再次按 enter 键执行。历史记录数据库存储在 ~/.local/share/stinkpot 中。如果升级导致数据库损坏,只需将其删除并重新运行导入命令即可。