Several changes, see commit msg

* clean up all tests
* bugfix for zero value functions, and test
* removed expand function, put in snippets
* added doc strings to Symbol type
* added doc strings to symbol declarations
* implemented display for Args type
* wrote a help function
* wrote docstrings for all builtins and config vars
This commit is contained in:
Ava Hahn 2023-03-05 22:18:49 -08:00
parent 4b587f11ab
commit dc6342bc74
Signed by untrusted user who does not match committer: affine
GPG key ID: 3A4645B8CF806069
16 changed files with 575 additions and 677 deletions

View file

@ -29,15 +29,19 @@ fn prompt_default_callback(_: &Seg, _: &mut SymTable) -> Result<Ctr, String> {
/* loads defaults, evaluates config script */
pub fn configure(filename: String, syms: &mut SymTable) -> Result<(), String> {
syms.insert(
/*syms.insert(
"CFG_RELISH_POSIX".to_string(),
Symbol {
name: String::from("CFG_RELISH_POSIX"),
args: Args::None,
conditional_branches: false,
docs: "variable holding whether or not POSIX job control functions are to be loaded.
checked at shell startup by configuration daemon. not used afterwards.
default value: not set".to_string(),
value: ValueType::VarForm(Box::new(Ctr::String("0".to_string()))),
},
);
);*/
syms.insert(
"CFG_RELISH_ENV".to_string(),
@ -45,6 +49,12 @@ pub fn configure(filename: String, syms: &mut SymTable) -> Result<(), String> {
name: String::from("CFG_RELISH_ENV"),
args: Args::None,
conditional_branches: false,
docs: "variable holding whether or not vars and other symbols should be linked to process environment variables.
If set/defined all calls to def will result in additions or subtractions from user environment variables.
checked at shell startup by configuration daemon. not used afterwards.
default value: 1 (set)
".to_string(),
value: ValueType::VarForm(Box::new(Ctr::String("1".to_string()))),
},
);
@ -55,6 +65,8 @@ pub fn configure(filename: String, syms: &mut SymTable) -> Result<(), String> {
name: String::from("default relish prompt"),
args: Args::None,
conditional_branches: false,
docs: "function called to output prompt. this function is called with no arguments.
default value (<lambda>)".to_string(),
value: ValueType::Internal(Rc::new(prompt_default_callback)),
},
);