Expand description

This crate allows you to permanently set environment variables

Examples

// Check if DUMMY is set, if not set it to 1
// export DUMMY=1
env_perm::check_or_set("DUMMY", 1).expect("Failed to find or set DUMMY");
// Append $HOME/some/cool/bin to $PATH
// export PATH= "$HOME/some/cool/bin:$PATH"
env_perm::append("PATH", "$HOME/some/cool/bin").expect("Couldn't find PATH");
// Sets a variable without checking if it exists.
// Note you need to use a raw string literal to include ""
// export DUMMY="/something"
env_perm::set("DUMMY", r#""/something""#).expect("Failed to set DUMMY");

Functions

Appends a value to an environment variable Useful for appending a value to PATH

Checks if a environment variable is set. If it is then nothing will happen. If it’s not then it will be added to your profile.

Prepends a value to an environment variable Useful for prepending a value to PATH

Sets an environment variable without checking if it exists. If it does you will end up with two assignments in your profile. It’s recommended to use check_or_set unless you are certain it doesn’t exist.