Skip to content

Commit

Permalink
Merge branch 'master' into condense-aliases-in-list-command
Browse files Browse the repository at this point in the history
  • Loading branch information
casey authored Dec 12, 2024
2 parents 79bc981 + 3ec4245 commit 2d42e8d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,13 @@ fn encode_uri_component(_context: Context, s: &str) -> FunctionResult {
Ok(percent_encoding::utf8_percent_encode(s, &PERCENT_ENCODE).to_string())
}

fn env(context: Context, key: &str, default: Option<&str>) -> FunctionResult {
match default {
Some(val) => env_var_or_default(context, key, val),
None => env_var(context, key),
}
}

fn env_var(context: Context, key: &str) -> FunctionResult {
use std::env::VarError::*;

Expand Down Expand Up @@ -295,13 +302,6 @@ fn env_var_or_default(context: Context, key: &str, default: &str) -> FunctionRes
}
}

fn env(context: Context, key: &str, default: Option<&str>) -> FunctionResult {
match default {
Some(val) => env_var_or_default(context, key, val),
None => env_var(context, key),
}
}

fn error(_context: Context, message: &str) -> FunctionResult {
Err(message.to_owned())
}
Expand Down

0 comments on commit 2d42e8d

Please sign in to comment.