Crates.io | envfetch |
lib.rs | envfetch |
version | 1.1.0 |
source | src |
created_at | 2024-11-30 14:44:47.108055 |
updated_at | 2024-12-12 13:58:00.093287 |
description | Lightweight cross-platform CLI tool for working with environment variables |
homepage | https://github.com/ankddev/envfetch |
repository | https://github.com/ankddev/envfetch |
max_upload_size | |
id | 1466685 |
size | 62,452 |
You can install envfetch from Cargo (needs Rust installed):
$ cargo install envfetch
Also, you can install it from source (needs Rust installed):
$ cargo install --git https://github.com/ankddev/envfetch envfetch
Or, get binary from GitHub Actions (needs GutHub account) or releases
To run envfetch, run envfetch <COMMAND> <ARGS>
in your terminal.
You can run envfetch help
to see help message or envfetch --version
to see program's version.
--exit-on-error
/-e
- exit on any errorSet environment variable and run process.
Usage:
envfetch set <KEY> <VALUE> [PROCESS]
, where:
KEY
- name of environment variableVALUE
- value of environment variablePROCESS
- name of process which you want to runOptions:
--help
/-h
- show help messageFor example:
$ envfetch set MY_VAR "Hello" "npm run"
It will set environment variable with name MY_VAR
value "Hello" and start npm run
Print all environment variables
Usage:
envfetch print
Options:
--help
/-h
- show help messageFor example:
$ envfetch print
SHELL = "powershell"
windir = "C:\\Windows"
SystemDrive = "C:"
SystemRoot = "C:\\Windows"
...
It will print all environment variables in format VAR = "VALUE"
.
Get value of environment variable
Usage:
envfetch get <KEY>
, where:
KEY
- name of environment variableOptions:
--help
/-h
- show help message--no-similar-names
/-s
- disable showing similar variables if variable notFor example:
$ envfetch get MY_VAR
"Hello"
It will print value of specified variable.
Delete variable and start process.
[!NOTE] Now variable deletes only for one run
Usage:
envfetch delete <KEY> <PROCESS>
, where:
KEY
- name of environment variablePROCESS
- name of command to runOptions:
--help
/-h
- show help messageFor example:
$ envfetch delete MY_VAR "npm run"
It will delete variable MY_VAR
and run npm run
command.
Load environment variables from dotenv-style file and run process.
[!NOTE] Now variables set only for one run
Usage:
envfetch load <PROCESS>
, where:
PROCESS
- name of process which you want to runOptions:
--help
/-h
- show help message--file <FILE>
/-f <FILE>
- relative or absolute path to file to read variables from. Note that it must in .env format.
By default, program loads variables from .env
file in current directory.For example:
$ envfetch load "npm run"
$ envfetch load "npm run" --file ".env.debug"
It will load variables from .env
or .env.debug
and start npm run
$ rustup update
Fork
on the top of this page<YOUR_USERNAME>
with your username on GitHub):$ git clone https://github.com/<YOUR_USERNAME>/envfetch.git
$ cd envfetch
<COMMAND>
and <ARGS>
to your command and args):$ cargo run -- <COMMAND> <ARGS>
$ cargo fmt
$ cargo clippy --fix
$ cargo test