-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
25 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,66 @@ | ||
# envset | ||
|
||
`envset` is a CLI for setting environment variables in .env files. this is something you may have never considered needing a specialized tool for. and you don't. but just like updating a git config it's just more fun doing it with a command. | ||
`envset` is a CLI for setting environment variables in .env files. | ||
|
||
this is something you may have never considered needing a specialized tool for. | ||
and you don't. | ||
but just like updating a git config it's more fun with a command. | ||
|
||
## installation | ||
|
||
available on homebrew and cargo: | ||
currently available on homebrew and [cargo](https://crates.io/crates/envset) | ||
|
||
```bash | ||
brew install schpet/tap/envset | ||
``` | ||
|
||
```bash | ||
cargo install envset | ||
``` | ||
|
||
## usage | ||
|
||
### set variables | ||
### set vars | ||
|
||
```bash | ||
# basic usage | ||
# basic usage, FYI that it prints a diff of the changes to stdout | ||
envset KEY1=value1 KEY2=value2 | ||
|
||
# some things are normally very annoying to add, like json or multiline strings | ||
# but envset has your back! | ||
envset JSON="$(cat credentials.json)" PRIVATE_KEY="$(openssl genrsa -out /dev/stdout 2048)" | ||
|
||
# pipe in stdin, useful for copying stuff from one env to another | ||
echo -e "KEY1=value1\nKEY2=value2" | envset | ||
|
||
# .env in the cwd is default, but you can use a different path | ||
envset --file .env.test KEY1=value1 | ||
# heroku users can easily copy parts of their config | ||
heroku config -s | grep "^AWS_" | envset | ||
|
||
# avoid clobbering existing values | ||
envset --no-overwrite KEY1=newvalue1 | ||
# override the default path to a .env file | ||
envset -f .env.test KEY1=value1 | ||
``` | ||
|
||
### get variables | ||
### read vars | ||
|
||
```bash | ||
# print all key value pairs | ||
# a few ways to print the current .env | ||
envset | ||
envset print --json | ||
|
||
# print a single value | ||
# grab a single value | ||
envset get KEY1 | ||
|
||
# print all keys | ||
# keys only, thanks | ||
envset keys | ||
``` | ||
|
||
### delete variables | ||
### delete vars | ||
|
||
```bash | ||
envset delete KEY1 KEY2 | ||
``` | ||
|
||
## about | ||
|
||
this cli was thrown together quickly with [aider](https://aider.chat/), i also put up [a blog post](https://schpet.com/linklog/envset-updates-env-files) explaining why i made this. | ||
this cli was thrown together quickly with [aider](https://aider.chat/), | ||
i also put up [a blog post](https://schpet.com/linklog/envset-updates-env-files) explaining why i made this. |