quick fix, simplify cd callback behaviour
Signed-off-by: Ava Affine <ava@sunnypup.io>
This commit is contained in:
parent
13135def5a
commit
6800e5c2b9
1 changed files with 4 additions and 14 deletions
|
|
@ -762,6 +762,10 @@ fn cd_callback(ast: &Seg, syms: &mut SymTable) -> Result<Ctr, Traceback> {
|
||||||
None,
|
None,
|
||||||
));
|
));
|
||||||
|
|
||||||
|
if !syms.contains_key(&CD_USER_CB.to_string()) {
|
||||||
|
return Ok(Ctr::None)
|
||||||
|
}
|
||||||
|
|
||||||
match syms.call_symbol(
|
match syms.call_symbol(
|
||||||
&CD_USER_CB.to_string(),
|
&CD_USER_CB.to_string(),
|
||||||
&Seg::new(),
|
&Seg::new(),
|
||||||
|
|
@ -990,18 +994,4 @@ pub fn load_posix_shell(syms: &mut SymTable, shell_state: Rc<RefCell<ShellState>
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
syms.insert(
|
|
||||||
String::from(CD_USER_CB),
|
|
||||||
Symbol {
|
|
||||||
name: String::from(CD_USER_CB),
|
|
||||||
args: Args::None,
|
|
||||||
conditional_branches: false,
|
|
||||||
docs: String::from("lambda called at each invocation of cd"),
|
|
||||||
value: ValueType::Internal(Rc::new(move |_ast: &Seg, _sym: &mut SymTable| -> Result<Ctr, Traceback> {
|
|
||||||
Ok(Ctr::None)
|
|
||||||
})),
|
|
||||||
..Default::default()
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue