9 stable releases
new 1.1.7 | Feb 7, 2025 |
---|---|
1.1.6 | Feb 6, 2025 |
1.1.2 | Jan 31, 2025 |
#666 in Command line utilities
915 downloads per month
30KB
723 lines
nvy 😡
nvy (pronounced "ehn-vee", like the word "envy") is a simple command line tool for managing multiple env files (profiles) in a project.
- supports exporting to a target file
- supports exporting to a shell
- note: child processes cannot modify the environment of the parent process, so the
use
command outputs the command text which can be eval'd to set the environment variables, when in shell mode.
- note: child processes cannot modify the environment of the parent process, so the
installation 📦
homebrew
brew tap jcserv/nvy
brew install nvy
cargo
cargo binstall nvy
(cargo-binstall)
or
cargo install nvy
usage ⚙️
nvy init
- to create a new nvy.yaml file in the current working directory- switching profiles
- shell mode:
eval "$(nvy use <profile>)"
- to switch between profiles- You can add an alias to your shell config to make this easier:
alias nv='eval "$(nvy use $1)"'
- file mode:
nvy target <target-file>
to set the target file to write tonvy use <profile>
to switch between profiles
- shell mode:
note: you can also use nvy use <profile1> <profile2> ...
to use multiple profiles
why 🤔
have you ever had multiple configurations with different environment variables that you had to switch between?
rather than tweaking the file by hand, or commenting out code, you can now:
- define separate profiles (a .env* file for each)
- use
nvy
to easily switch between
also, this was an opportunity for me to learn Rust by doing.
references 📚
Dependencies
~5–11MB
~142K SLoC