Skip to content

Commit

Permalink
Allow exact env-variable specification
Browse files Browse the repository at this point in the history
  • Loading branch information
Pencilcaseman committed Aug 15, 2024
1 parent f3bf96f commit 31b472f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ pub enum Dependency {
#[derive(Debug, Clone)]
pub enum Environment {
Set(String),
SetExact(String),
Append(String),
Prepend(String),
}
Expand Down Expand Up @@ -346,6 +347,7 @@ impl Module {
.into_iter()
.map(|(name, (op, value))| match op.as_ref() {
"set" => Ok((name, Environment::Set(value))),
"setexact" => Ok((name, Environment::SetExact(value))),
"append" => Ok((name, Environment::Append(value))),
"prepend" => Ok((name, Environment::Prepend(value))),
other => Err(format!(
Expand Down
1 change: 1 addition & 0 deletions src/modulefile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ pub fn generate(module: &Module) -> String {
environment_variables.push_str(&match value {
// Environment::Set(val) => format!("setenv \"{key}\" \"{val}\"\n"),
Environment::Set(val) => format!("::flavours::modify-path setenv \"{key}\" \"{val}\"\n"),
Environment::SetExact(val) => format!(" setenv \"{key}\" \"{val}\"\n"),
Environment::Append(val) => format!("::flavours::append-path \"{key}\" \"{val}\"\n"),
Environment::Prepend(val) => {
format!("::flavours::modify-path prepend-path \"{key}\" \"{val}\"\n")
Expand Down
1 change: 1 addition & 0 deletions src/sccmod/env.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
SET = "set"
SET_EXACT = "setexact"
APPEND = "append"
PREPEND = "prepend"

0 comments on commit 31b472f

Please sign in to comment.