implement expose stubs for subcommands

This commit is contained in:
🪞👃🪞 2025-05-09 19:47:47 +03:00
parent 87cd6099ad
commit 6d4a629311
3 changed files with 68 additions and 5 deletions

View file

@ -122,8 +122,7 @@ impl Configuration {
return Err(format!("(e4) unexpected non-symbol {next:?}").into())
};
let next = exp.next();
if let Some(Token { value: Value::Str(path), .. }) = next {
if let Some(Token { value: Value::Str(path), .. }) = exp.peek() {
let path = base.as_ref().parent().unwrap().join(unquote(path));
if !std::fs::exists(&path)? {
return Err(format!("(e5) not found: {path:?}").into())
@ -133,8 +132,9 @@ impl Configuration {
println!("ok");
let cond = cond.unwrap();
map.add_layer_if(
Box::new(|state|{
Context::get(state, &Value::Sym(cond)).unwrap_or(false)
Box::new(move |state|{
let mut exp = exp.clone();
Context::get(state, &mut exp).unwrap_or(false)
}),
keys
);