Compare commits
2 Commits
c17a36ba07
...
df5661fa2b
Author | SHA1 | Date | |
---|---|---|---|
df5661fa2b | |||
6fdf4de722 |
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "expressive"
|
name = "expressive"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
description = "Fork of evalexpr"
|
description = "Fork of evalexpr"
|
||||||
authors = ["jeff <dev@jeffa.io.com>"]
|
authors = ["jeff <dev@jeffa.io.com>"]
|
||||||
repository = "https://git.jeffa.io/jeff/expressive.git"
|
repository = "https://git.jeffa.io/jeff/expressive.git"
|
||||||
@ -10,7 +10,7 @@ license = "MIT"
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
name = "evalexpr"
|
name = "expressive"
|
||||||
path = "src/lib.rs"
|
path = "src/lib.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
pub fn main() -> Result<(), Box<dyn std::error::Error>> {
|
pub fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let args = std::env::args().skip(1).collect::<Vec<String>>().join(" ");
|
let args = std::env::args().skip(1).collect::<Vec<String>>().join(" ");
|
||||||
|
|
||||||
println!("{}", evalexpr::eval(&args)?);
|
println!("{}", expressive::eval(&args)?);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
pub fn main() -> Result<(), Box<dyn std::error::Error>> {
|
pub fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let args = std::env::args().skip(1).collect::<Vec<String>>().join(" ");
|
let args = std::env::args().skip(1).collect::<Vec<String>>().join(" ");
|
||||||
|
|
||||||
println!("{}", evalexpr::eval(&args)?);
|
println!("{}", expressive::eval(&args)?);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,10 @@ impl Context for VariableMap {
|
|||||||
None
|
None
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
self.variables.get(identifier)
|
self.variables.get(identifier).or_else(|| {
|
||||||
|
self.call_function(identifier, &Value::Empty);
|
||||||
|
None
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
37
src/toolbox.rs
Normal file
37
src/toolbox.rs
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
use crate::Result;
|
||||||
|
|
||||||
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
pub fn build(variables: &HashMap<String, Value>) -> Result<Value> {
|
||||||
|
let name = {
|
||||||
|
let name = if let Some(value) = variables.get("name") {
|
||||||
|
format!("--name {}", value)
|
||||||
|
} else {
|
||||||
|
String::with_capacity(0)
|
||||||
|
};
|
||||||
|
|
||||||
|
Value::String(name)
|
||||||
|
};
|
||||||
|
let image = {
|
||||||
|
let image = if let Some(value) = variables.get("image") {
|
||||||
|
format!("--image {}", value)
|
||||||
|
} else {
|
||||||
|
String::with_capacity(0)
|
||||||
|
};
|
||||||
|
|
||||||
|
Value::String(image)
|
||||||
|
};
|
||||||
|
|
||||||
|
// let toolbox_command = format!("toolbox create --image {} {}", &image, &name);
|
||||||
|
// Command::new("fish")
|
||||||
|
// .arg("-c")
|
||||||
|
// .arg(&toolbox_command)
|
||||||
|
// .spawn()
|
||||||
|
// .unwrap()
|
||||||
|
// .wait()
|
||||||
|
// .unwrap();
|
||||||
|
|
||||||
|
println!("{} {}", image, name);
|
||||||
|
|
||||||
|
Ok(Value::String("Built container.".to_string()))
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user