shell fully configurable
This commit is contained in:
parent
1ce5fd3454
commit
a711b32730
4 changed files with 117 additions and 29 deletions
47
src/run.rs
47
src/run.rs
|
|
@ -25,8 +25,16 @@ use std::iter::FromIterator;
|
|||
use std::env::{vars, var, current_dir};
|
||||
use std::rc::Rc;
|
||||
|
||||
fn prompt_default_callback(_: &Seg, _: &mut SymTable) -> Result<Ctr, String> {
|
||||
Ok(Ctr::Symbol("λ".to_string()))
|
||||
fn l_prompt_default_callback(_: &Seg, _: &mut SymTable) -> Result<Ctr, String> {
|
||||
Ok(Ctr::String("λ".to_string()))
|
||||
}
|
||||
|
||||
fn r_prompt_default_callback(_: &Seg, _: &mut SymTable) -> Result<Ctr, String> {
|
||||
Ok(Ctr::String(String::new()))
|
||||
}
|
||||
|
||||
fn prompt_delimiter_default_callback(_: &Seg, _: &mut SymTable) -> Result<Ctr, String> {
|
||||
Ok(Ctr::String(">".to_string()))
|
||||
}
|
||||
|
||||
fn get_paths() -> Vec<String> {
|
||||
|
|
@ -70,15 +78,40 @@ default value: 1 (set)
|
|||
);
|
||||
|
||||
syms.insert(
|
||||
"CFG_RELISH_PROMPT".to_string(),
|
||||
"CFG_RELISH_L_PROMPT".to_string(),
|
||||
Symbol {
|
||||
name: String::from("default relish prompt"),
|
||||
name: String::from("default relish left prompt"),
|
||||
args: Args::None,
|
||||
conditional_branches: false,
|
||||
docs: "function called to output prompt. this function is called with no arguments.
|
||||
default value (<lambda>)"
|
||||
docs: "function called to output prompt on left hand. this function is called with no arguments."
|
||||
.to_string(),
|
||||
value: ValueType::Internal(Rc::new(prompt_default_callback)),
|
||||
value: ValueType::Internal(Rc::new(l_prompt_default_callback)),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
|
||||
syms.insert(
|
||||
"CFG_RELISH_R_PROMPT".to_string(),
|
||||
Symbol {
|
||||
name: String::from("default relish right prompt"),
|
||||
args: Args::None,
|
||||
conditional_branches: false,
|
||||
docs: "function called to output prompt on right hand. this function is called with no arguments."
|
||||
.to_string(),
|
||||
value: ValueType::Internal(Rc::new(r_prompt_default_callback)),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
|
||||
syms.insert(
|
||||
"CFG_RELISH_PROMPT_DELIMITER".to_string(),
|
||||
Symbol {
|
||||
name: String::from("default relish prompt delimiter"),
|
||||
args: Args::None,
|
||||
conditional_branches: false,
|
||||
docs: "function called to output prompt delimiter. this function is called with no arguments."
|
||||
.to_string(),
|
||||
value: ValueType::Internal(Rc::new(prompt_delimiter_default_callback)),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue