Easily switch between predefined values for arbitrary environment variables Features include (but are not limited to):
es set
, or run a one-off command in a modified environment with es run
```toml
[applications.server.profiles.dev] variables = {SERVICE1 = "dev", SERVICE2 = "also-dev"}
[applications.server.profiles.prd] variables = {SERVICE1 = "prd", SERVICE2 = "also-prd"} ```
```sh
es set server ❯ === dev === SERVICE1=dev SERVICE2=also-dev
=== prd === SERVICE1=prd SERVICE2=also-prd
echo $SERVICE1 $SERVICE2 dev also-dev ```
See the Usage Guide for more detailed examples.
sh
brew install lucaspickering/tap/env-select
sh
cargo install env-select
This may not be necessary, depending on what shell you use and how you installed env-select. The easiest way to check is to open a new shell and run es help
.
Because env-select modifies your shell environment, it requires a wrapper function defined in the shell that can call the env-select
binary and automatically apply its output.
All commands in this README/usage guide assume you have the appropriate shell configuration. See the disclaimer for why this is needed.
sh
echo 'eval "$(env-select init)"' >> ~/.bashrc
source ~/.bashrc # Run this in every existing shell
sh
echo 'source <(env-select init)' >> ~/.zshrc
source ~/.zshrc # Run this in every existing shell
sh
echo 'env-select init | source' >> ~/.config/fish/config.fish
source ~/.config/fish/config.fish # Run this in every existing shell
Restart your shell (or source <file>
) after running the above command.
source
Disclaimerenv-select runs as a subprocess to your shell (as all commands do), meaning it cannot modify your shell environment. To get around this, env-select will simply output shell commands that the shell plugins (or you) can then pipe to source
(or eval
) to modify your session.
If you think piping stuff to source
is dangerous and sPoOky, you're right. But consider the fact that at this point, you've already downloaded and executed a mystery binary on your machine. You should've already done your due diligence.
es: command not found
Make sure you've configured your shell to load the es
function automatically.
If you find a bug or have a feature request, please open an issue on GitHub.