tenv (temporary environment)
Small CLI app for running commands with temporary environment variables. Super useful on Windows/Powershell where you can't easily set temp variables inline with command being run.
Uses
Running commands
Bash
# Add ~/hugo to PATH and run `hugo` program
Powershell
# Add C:\dev\hugo to PATH and run `hugo` program
Especially useful for RUST_BACKTRACE on Powershell
tenv -e RUST_BACKTRACE=1 cargo -- run
Shell environment
Bash
# spawn new bash shell with env vars APPLES="Red" and BANANAS="Yellow"
Powershell
<# spawn new Powershell with env vars APPLES="Red" and BANANAS="Yellow" #>
tenv -e APPLES=Red -a BANANAS=Yellow powershell
Caveat
Because some shell commands aren't directly callable from Command::new() (i.e. the cat alias on Powershell), tenv runs programs directly through powershell on Windows and bash otherwise.