pet
Command-line snippet manager written in Go. Save, tag, search, and run shell command snippets with parameters, stored in TOML and synced via Gist or GitLab.
pet is a command-line snippet manager written in Go, inspired by memo. It stores commands you rarely use or can't easily recall, along with descriptions and tags, so you can find them later instead of digging through shell history. Snippets are created with pet new (or pet new --multiline for multiline commands) and managed through subcommands such as list, search, exec, clip, edit, configure, and sync.
Snippets can include parameters written as <param> or <param=default_value>, including multiple default values per parameter. Snippets live in a TOML file that you can edit directly with pet edit, and a snippet can also store a command's output (displayed by pet list but not searchable). The config supports a custom editor, sort order, the shell command used to run snippets, an output format string, and multiple snippet directories or files. Interactive selection uses fzf or peco.
Shell integration is documented for bash, zsh, and fish. The README provides a prev function that registers the previous command with pet new, and a key binding (for example Ctrl-s in zsh) that runs pet search and puts the chosen snippet on the current command line, like Ctrl-r. Because the command lands in the shell buffer, running it adds it to shell history and lets you chain commands. A --raw mode lets you expand parameters with native shell editing instead of the built-in dialog. Snippets can be filtered by tag with -t, and an fzf alt+s binding can save a command from history.
pet can sync the snippet file through GitHub Gist, GitHub Enterprise, or GitLab Snippets, with an optional auto_sync setting that syncs on edits. The selected snippet can be copied to the clipboard with pet clip (the README mentions pbcopy on macOS). It is aimed at developers and operators who work across many tools and want a searchable, shareable set of commands.
Installation
# via Homebrew
brew install pet
Alternatives & related tools
Carapace
A single binary providing argument completion for many CLI commands across Bash, Zsh, Fish, Nushell, Elvish, PowerShell, Xonsh and other shells.
up
Interactive terminal UI for building Linux pipelines with live preview of command results
shfmt
Shell script formatter built on a Go parser for POSIX sh, Bash, Zsh and mksh. The same repo ships a syntax package, shell helpers and an interpreter.
direnv
Shell extension that automatically loads and unloads environment variables based on current directory
gum
CLI tool providing interactive components for shell scripts with input prompts, menus, spinners, and styling
add a badge to your README
Maintain pet? Show that it's featured on trmn. The badge links back to this page.
[](https://www.trmn.sh/tools/pet?utm_source=badge)<a href="https://www.trmn.sh/tools/pet?utm_source=badge"><img src="https://www.trmn.sh/badge/pet.svg" alt="Featured on trmn" height="20"></a>