Crates.io | env-select |
lib.rs | env-select |
version | 1.2.0 |
source | src |
created_at | 2022-10-19 16:55:04.774829 |
updated_at | 2024-10-09 20:22:30.986827 |
description | Easily switch between common values for arbitrary environment variables |
homepage | |
repository | https://github.com/LucasPickering/env-select |
max_upload_size | |
id | 691785 |
size | 242,559 |
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
# .env-select.toml
[applications.server.profiles.dev]
variables = {SERVICE1 = "dev", SERVICE2 = "also-dev"}
[applications.server.profiles.prd]
variables = {SERVICE1 = "prd", SERVICE2 = "also-prd"}
Now pick an environment to export:
> es set server
❯ === dev ===
SERVICE1=dev
SERVICE2=also-dev
=== prd ===
SERVICE1=prd
SERVICE2=also-prd
> echo $SERVICE1 $SERVICE2
dev also-dev
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.
If you find a bug or have a feature request, please open an issue on GitHub.