working on context ergonomics
This commit is contained in:
parent
4116cb9728
commit
fb413aa8ce
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -810,6 +810,7 @@ dependencies = [
|
|||
"clap",
|
||||
"glob",
|
||||
"roxy_core",
|
||||
"serde",
|
||||
"syntect",
|
||||
"tera",
|
||||
"toml",
|
||||
|
|
|
@ -10,4 +10,5 @@ roxy_core = { git = "https://github.com/kitsunecafe/roxy-core.git" }
|
|||
clap = { version = "4.4.17", features = ["derive"] }
|
||||
toml = "0.8.8"
|
||||
tera = "1.19.1"
|
||||
serde = "1.0.195"
|
||||
|
||||
|
|
17
src/main.rs
17
src/main.rs
|
@ -108,6 +108,23 @@ impl<'a, P: AsRef<Path> + 'a> FilePath<'a, P> {
|
|||
}
|
||||
}
|
||||
|
||||
struct Context {
|
||||
pub inner: tera::Context,
|
||||
}
|
||||
|
||||
impl Context {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
inner: tera::Context::new(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn insert<P: AsRef<Path>, K: Serialize, V: Serialize>(&mut self, path: &P, key: K, value: V) {
|
||||
let path = path.as_ref();
|
||||
self.inner.insert(&key, &value);
|
||||
}
|
||||
}
|
||||
|
||||
fn main() -> Result<(), RoxyError> {
|
||||
let opts = Options::parse();
|
||||
|
||||
|
|
Loading…
Reference in a new issue