Support ENV variables in CD names
This commit is contained in:
@@ -38,6 +38,8 @@ macro_rules! format_if_error_drop_cause {
|
||||
};
|
||||
}
|
||||
|
||||
const DEFAULT_ENV_EXPAND_OPTIONS : ExpandOptions = ExpandOptions{expansion_type: Some(ExpansionType::All), default_to_empty: false};
|
||||
|
||||
pub struct Error {
|
||||
pub exit_code: i32,
|
||||
pub text: String,
|
||||
@@ -162,8 +164,12 @@ pub fn callback_if_any_error<F: Fn(String) -> String, T, E: std::string::ToStrin
|
||||
}
|
||||
}
|
||||
|
||||
pub fn string_with_env_from(str: &str) -> String {
|
||||
String::from(envmnt::expand(str, Some(DEFAULT_ENV_EXPAND_OPTIONS)))
|
||||
}
|
||||
|
||||
pub fn path_with_env_from(path: &str) -> PathBuf {
|
||||
PathBuf::from(envmnt::expand(path, Some(ExpandOptions{expansion_type: Some(ExpansionType::All), default_to_empty: false})))
|
||||
PathBuf::from(envmnt::expand(path, Some(DEFAULT_ENV_EXPAND_OPTIONS)))
|
||||
}
|
||||
|
||||
pub fn open_output_file(output_path: &PathBuf) -> Result<BufWriter<std::fs::File>, Error> {
|
||||
|
Reference in New Issue
Block a user