A simple CLI for swapping between .env files
Project description
Swap Env
swap-env
is a simple CLI for swapping between different .env
files.
Requirements
python >= 3.9
Installation
- with
pipx
(recommended):
pipx install swap-env
If you use a version of python less than 3.9
, you can provide pipx with a different version to use for this package.
I'd recommend pyenv for managing python versions:
# make sure you have python3.9 installed
pyenv install 3.9
# use that version with pipx
pipx install --python $(pyenv which python3.9) swap-env
- with
pip
:
pip install swap-env
Usage
Save any .env
files you regularly use to a directory called .swap-env/
.
This can be in any parent directory of where you want to use it, or in your home directory.
Name them .env.<name>
and you'll access them via <name>
in swap-env
.
If you have a local .env
file (not a symlink), you will be prompted whether to save it first.
$ ls -A1 ~/.swap-env
.env.dev
.env.test
Then simply run swap-env
and select the file you want to use. A symlink will be created at ./.env
to that file.
$ swap-env
? Select a .env file:
❯ dev
test
? Select a .env file: dev
$ ls -l .env
... .env@ -> ~/.swap-env/.env.dev
swap-env
will search upwards from the directory you run it in and use the first .swap-env/
directory it finds.
If you're not under the home directory, or a .swap-env/
directory isn't found, ~/.swap-env/
will be used (and created if it doesn't exist).
If you create a .swap-env/
directory in a git repo, remember to add it to your .gitignore
.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file swap_env-1.0.2.tar.gz
.
File metadata
- Download URL: swap_env-1.0.2.tar.gz
- Upload date:
- Size: 17.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.4.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0eed7ac8b4c2145599a9dd250965c87341016b98e0f92869b68bbeadfe57b074 |
|
MD5 | 9def86e9676215e06d8a7424f4cc9fe6 |
|
BLAKE2b-256 | 2173f29b4e7bf4b4b8a5a81b44a14940875be44de0496ce7e8b714f4ac7d3931 |
File details
Details for the file swap_env-1.0.2-py3-none-any.whl
.
File metadata
- Download URL: swap_env-1.0.2-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.4.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1a9a8ffef56f2be0640b383aa9a34242fbfc773542c3198e0dfbc06546acf2cf |
|
MD5 | 2787a8488d6ecea3105500c06d78d357 |
|
BLAKE2b-256 | 7d995f31d07832e0be2519829b9a67cf6988262015096a76fc5c6fdfdba7db99 |