improvements to configuration system

This commit is contained in:
Ava Apples Affine 2023-03-18 23:00:55 -07:00
parent bfd1058ad7
commit 8a91560921
Signed by: affine
GPG key ID: 3A4645B8CF806069
3 changed files with 15 additions and 15 deletions

View file

@ -393,8 +393,8 @@ Errors during configuration are non-terminal. In such a case any defaults which
- Variables and functions defined during configuration will carry over to the user/script interpreter, allowing the user to load any number of custom functions and variables.
*** Configuration Values
- CFG_RELISH_POSIX (default 0): when on, enables POSIX style job control.
- CFG_RELISH_ENV (default 1): when on, interpreter's variable table and environment variable table are kept in sync.
- CFG_RELISH_POSIX (default false): when true, enables POSIX style job control.
- CFG_RELISH_ENV (default true): when true, interpreter's variable table and environment variable table are kept in sync.
- CFG_RELISH_PROMPT (default (echo "λ ")): A *function* definition which is called in order to output the prompt for each loop of the REPL.
This function will be reloaded each REPL loop and will be called by the interpreter with no arguments.

View file

@ -29,19 +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(
"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.
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()))),
},
);*/
default value: false".to_string(),
value: ValueType::VarForm(Box::new(Ctr::Bool(false))),
},
);
syms.insert(
"CFG_RELISH_ENV".to_string(),
@ -55,7 +55,7 @@ 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()))),
value: ValueType::VarForm(Box::new(Ctr::Bool(true))),
},
);

View file

@ -548,7 +548,7 @@ pub fn dynamic_stdlib(syms: &mut SymTable) -> Result<(), String> {
.call_symbol(&"CFG_RELISH_ENV".to_string(), &Seg::new(), true)
.unwrap_or_else(|_: String| Box::new(Ctr::None))
.to_string()
.ne("");
.eq("true");
syms.insert(
"def".to_string(),