`pet` is a simple command-line snippet manager. It allows you to write and store snippets for the command-line, so you don't need to remember all the commands you frequently use in you terminal. It can sync your snippets to the GitHub Gist, so you can always take your snippets with you.
My friend once recommended to take a look at
pet. As I’m working with
command-line all the time a snippet manager in this workflow is a
low-hanging fruit. It immediately reduced amount of time I spend on some
tasks that do not deserve to be written in a separate script, but at the
same time are cumbersome to remember.
Use cases for it are some complex one-liners, like
sed, or even
In order to create a new snippet, you need to run:
pet will ask you to enter the actual command and its description. For
example I often use a command to delete merged git branches from my local
git checkout master && git fetch -p && git branch --merged | egrep -v "master" | xargs git branch -d
However I often want to preserve some branches without deletion, and in
pet allows you to have some patterns, that you can fill before
executing a command. It’s done using the following format:
So in my case it would be like this:
git checkout master && git fetch -p && git branch --merged | egrep -v "(<branches=master>)" | xargs git branch -d
After adding this snippet, before it’s executed I’ll need to provide a value
branches instead of using
pet is quite powerful, easy to use and very portable, what makes
it a good piece of software that I’d recommend anyone to take a look at.