https://github.com/jcserv/nvy
nvy is a CLI tool, written in Rust, for managing multiple .env files in a project
https://github.com/jcserv/nvy
cli configuration env rust
Last synced: 6 months ago
JSON representation
nvy is a CLI tool, written in Rust, for managing multiple .env files in a project
- Host: GitHub
- URL: https://github.com/jcserv/nvy
- Owner: jcserv
- License: gpl-3.0
- Created: 2025-01-31T00:08:02.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-01T13:10:23.000Z (over 1 year ago)
- Last Synced: 2025-09-21T11:53:23.414Z (10 months ago)
- Topics: cli, configuration, env, rust
- Language: Rust
- Homepage: https://crates.io/crates/nvy
- Size: 47.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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.
## installation 📦
### homebrew
`brew tap jcserv/cask`
`brew install nvy`
### cargo
`cargo binstall nvy` ([cargo-binstall](https://github.com/cargo-bins/cargo-binstall?tab=readme-ov-file#installation))
or
`cargo install nvy`
## usage ⚙️
1. `nvy init` - to create a new nvy.yaml file in the current working directory
2. switching profiles
- shell mode:
- `eval "$(nvy use )"` - 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 ` to set the target file to write to
- `nvy use ` to switch between profiles
note: you can also use `nvy use ...` 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:
1. define separate profiles (a .env* file for each)
2. use `nvy` to easily switch between
also, this was an opportunity for me to learn Rust by doing.
## references 📚
- [Command Line Applications in Rust](https://rust-cli.github.io/book/index.html)
- [How to Deploy Rust Binaries with GitHub Actions](https://dzfrias.dev/blog/deploy-rust-cross-platform-github-actions/)
- [How to Publish your Rust project on Homebrew](https://federicoterzi.com/blog/how-to-publish-your-rust-project-on-homebrew/)