Superpet: A Developer's Best Friend

Superpet: A Developer's Best Friend

Managing environment variables is a pain.

Typical solutions like dot env files don't cut it when working with launching docker containers, CLI tools and commands, scripts, etc. For this reason, I've augmented a tool called Pet to create Superpet, an environment variable and snippets manager.

This is going to be a quick read that aims to showcase Superpet, so buckle in!

Superpet Showcase

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  # searches environments and activates selected

$ superpet editenv

$ superpet newenv  # Creates a new environment

Basic Superpet commands

Creating a new environment example

When listing environments, Superpet hides the values of the variables, but shows their names to better describe the environment.

Example of listing all environments

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.

Most Important Command

This is what you're here for.

Activate Superpet environment shell
Environment selection menu

That's all there is to it. You pick the environment, and it's activated automatically.

Exit Superpet environment shell

Overview of Pet, Snippet Management

Pet, the original project, 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:

Example of searching for a command to execute with ctrl+s or pet exec
Parametrized Pet snippet for deleting all documents from an Elasticsearch index
Pet list command, showing a bunch of command snippets I've saved

Pet really streamlined my workflow, but I felt that it could do even more. Managing environment variables was 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.

Parting Words

I'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.

If you found this helpful, consider supporting me by subscribing for free below and following me on Twitter @iamramiawar!

GitHub - RamiAwar/superpet: Simple command-line environment and snippet manager, written in Go.
Simple command-line environment and snippet manager, written in Go. - GitHub - RamiAwar/superpet: Simple command-line environment and snippet manager, written in Go.

Rami Awar

Rami Awar

Delft, Netherlands