Skip to content
/ qevs Public

Quick Environment Variable Switcher

License

Notifications You must be signed in to change notification settings

tslmy/qevs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Quick Environment Variable Switcher (Qevs)

pre-commit

Provides a quick way to switch between values for environment variables.

Demo:

asciicast

Usage

In the directory where you prepared the _qevs/*_options.txt files, run qs.

You can type to filter for the desired option (with fuzzy matching) or click on a choice with your mouse. If you need to set a new value that is absent in the options provided, simply enter it, and Qevs will remember it for the next time.

To unset an environment variable, just hit esc.

Setup

  1. Install fzf.
  2. For each environment variable X that you want to switch values, create a file named _qevs/X_options.txt, where each line is a possible value for this variable.

For bash, zsh, etc.

Run these lines:

curl https://raw.githubusercontent.com/tslmy/qevs/main/qevs.sh --output ~/bin/qevs.sh && chmod +x ~/bin/qevs.sh
echo 'alias qs="~/bin/qevs.sh && source /tmp/choices.sh && rm /tmp/choices.sh"' >> ~/.profile

For fish

Run these lines:

curl https://raw.githubusercontent.com/tslmy/qevs/main/qevs.fish --output ~/.config/fish/functions/qs.fish

License

MIT.