Pet is a command line snippet manager written in Go that has massively sped up all my command line work. I’ve extended it into Superpet to allow environment variable management as well, and I found it to be a huge time saver and worth sharing with others.
Edit: I’ve since become a collaborator on Pet! I’ll be adding in all the sweet Superpet features in and more when I have some time!
I’ll first quickly describe Pet, and then explain what Superpet is and show usage examples. I won’t write too much as I think the examples are sufficient to sell the idea.
Pet gives you the ability to create snippets, tag them, search them, list them, and even parametrize them. It also automatically syncs any changes I make to my snippets across machines through free Github gists. (Yes, you heard that right. There can exist a sync feature without having to pay a monthly fee. I nearly forgot that such things could exist!)
Here are a bunch of useful features of Pet:
Pet really streamlined my workflow, but I felt that it could do even more. Managing environment variables is a very similar problem to managing snippets: you’d normally have a bunch of environment variables associated with doing a single task. For this reason, it made sense to group them in one place and have the ability to call upon them as we do with snippets.
To use Superpet, you can use the following commands for managing env vars. Similar to many “environment activation” tools out there (think virtual environments in Python), Superpet is able to “activate” an environment for you, inheriting the current environment variables and extending them with those of the namespace specified.
$ superpet listenv$ superpet activate # Similar to pet exec, but searches environments
# and activates them$ superpet editenv$ superpet newenv # Creates a new environment
When listing environments, Superpet hides the values of the variables, but shows their names to better describe the environment.
It’s also easy to edit the environments and snippets using superpet edit
and superpet editenv
. All the snippets/environments are saved in .toml files that are stored in ~/.config/pet/
by default.
To activate/deactivate environments:
We’ve also started using Superpet to streamline onboarding. Providing newcomers with a bunch of preconfigured snippets and environments would supercharge their onboarding experience. Installation instructions can be found in the repository.