- Print all environment variables
- Get value of variable by name
- Show similar variables if given variable not found
- Set variable (temporary and permanent)
- Delete variable (temporary and permanent)
- Load variables from dotenv-style file (temporary and permanent)
- Add string to the end of variable
- Set and delete multiple variables at once
envfetch is available as a package in the AUR. You can install it with an AUR helper (e.g. paru
):
$ paru -S envfetch
You can install envfetch from Scoop using this command:
scoop install https://gist.githubusercontent.com/ankddev/f6314b552aa021f676fc999ec697f833/raw/envfetch.json
Note, that it uses manifest, published only as GitHub Gist.
You can download .deb package from releases and thhen execute:
sudo dpkg -i <deb-package>
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.
Set environment variable and optionally 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 run (optional if --global is used)
Options:
--help
/-h
- show help message--global
/-g
- set variable permanently in system environment- On Windows: stores in registry
- On Unix: stores in shell config (.bashrc, .zshrc, or config.fish)
For example:
$ envfetch set MY_VAR "Hello" "npm run" # temporary for process
$ envfetch set MY_VAR "Hello" --global # permanent system-wide
Add value to the end of environment variable and optionally run the process
Usage:
envfetch add <KEY> <VALUE> [PROCESS]
, where:
KEY
- name of environment variableVALUE
- value of environment variable to addPROCESS
- name of process which you want to run (optional if --global is used)
Options:
--help
/-h
- show help message--global
/-g
- update variable permanently in system environment- On Windows: stores in registry
- On Unix: stores in shell config (.bashrc, .zshrc, or config.fish)
For example:
$ envfetch add PATH "../hello.exe" "crago run" # temporary for process
$ envfetch add MY_VAR "Hello" --global # permanent system-wide
Print all environment variables
Usage:
envfetch print
Options:
--help
/-h
- show help message
For 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 variable
Options:
--help
/-h
- show help message--no-similar-names
/-s
- disable showing similar variables if variable not
For example:
$ envfetch get MY_VAR
"Hello"
It will print value of specified variable.
Delete variable and optionally start process.
Usage:
envfetch delete <KEY> [PROCESS]
, where:
KEY
- name of environment variablePROCESS
- name of command to run (optional if --global is used)
Options:
--help
/-h
- show help message--global
/-g
- delete variable permanently from system environment
For example:
$ envfetch delete MY_VAR "npm run" # temporary for process
$ envfetch delete MY_VAR --global # permanent system-wide
Load environment variables from dotenv-style file and optionally run process.
Usage:
envfetch load [PROCESS]
, where:
PROCESS
- name of process which you want to run (optional if --global is used)
Options:
--help
/-h
- show help message--file <FILE>
/-f <FILE>
- relative or absolute path to file to read variables from. Note that it must be in .env format. By default, program loads variables from.env
file in current directory.--global
/-g
- load variables permanently into system environment
For example:
$ envfetch load "npm run" # temporary for process
$ envfetch load --global # permanent system-wide
$ envfetch load --global --file .env.prod # permanent from specific file
Note
When using --global
flag:
- On Windows, variables are stored in the registry under HKEY_CURRENT_USER\Environment
- On Unix-like systems, variables are stored in shell configuration files (.bashrc, .zshrc, or config.fish)
Without --global
flag, variables are only set for the current process run
- Install Rust. If it already installed, update with
$ rustup update
- Fork this project using button
Fork
on the top of this page - Clone your fork (replace
<YOUR_USERNAME>
with your username on GitHub):
$ git clone https://github.com/<YOUR_USERNAME>/envfetch.git
- Go to directory, where you cloned envfetch:
$ cd envfetch
- Run program using Cargo (replace
<COMMAND>
and<ARGS>
to your command and args):
$ cargo run -- <COMMAND> <ARGS>
- codewars-api-rs - Rust library for Codewars API
- conemu-progressbar-go - Progress bar for ConEmu for Go
- terminal-go - Go library for working with ANSI/VT terminal sequences
- zapret-discord-youtube - Zapret build for Windows for fixing Discord and YouTube in Russia or other services
- Read section above to build envfetch from source
- Create new branch
- Made your changes
- Test that everything works correctly
- Format and lint code with
$ cargo fmt
$ cargo clippy --fix
- Run tests with
$ cargo test
- Push changes
- Open pull request