Skip to content

Commit

Permalink
Allow for setting (but not unsetting!) variables
Browse files Browse the repository at this point in the history
As described in #31. This commit is feature incomplete.
  • Loading branch information
superatomic committed Apr 24, 2022
1 parent 42c9952 commit 29fa39f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/config_file.rs
Expand Up @@ -49,6 +49,7 @@ pub(crate) enum EnvVariableOption {
pub(crate) enum EnvVariableValue {
String(String),
Array(Vec<String>),
Set(bool),
}

#[cfg(test)]
Expand Down
2 changes: 2 additions & 0 deletions src/main.rs
Expand Up @@ -233,6 +233,8 @@ fn to_shell_source(vars: &EnvironmentVariables, shell: &Shell) -> String {
// Any arrays are treated as a path.
let (value, is_path) = match raw_value.clone() {
EnvVariableValue::String(string) => (expand_value(&string), false),
EnvVariableValue::Set(true) => ("1".to_string(), false),
EnvVariableValue::Set(false) => continue, // todo!
EnvVariableValue::Array(array) => {
let v_expanded: Vec<String> =
array.iter().map(|value| expand_value(value)).collect();
Expand Down

0 comments on commit 29fa39f

Please sign in to comment.