add )exit & )off

This commit is contained in:
dzaima 2023-01-07 02:22:19 +02:00
parent 38ec07c34b
commit 26c12e6724
2 changed files with 6 additions and 0 deletions

View File

@ -2,6 +2,10 @@
These are commands usable from a CBQN REPL that, for one reason or another, aren't suited to be system functions. These are commands usable from a CBQN REPL that, for one reason or another, aren't suited to be system functions.
## `)exit` / `)off`
Equivalent to `•Exit 0`
## `)ex path/to/file` ## `)ex path/to/file`
Execute the contents of the file as if it were REPL input (but allowing multiline definitions). Not a system function because modifying the list of global variables during execution is not allowed. Execute the contents of the file as if it were REPL input (but allowing multiline definitions). Not a system function because modifying the list of global variables during execution is not allowed.

View File

@ -592,6 +592,8 @@ void cbqn_runLine0(char* ln, i64 read) {
else printf("Unknown theme\n"); else printf("Unknown theme\n");
return; return;
#endif #endif
} else if (isCmd(cmdS, &cmdE, "exit") || isCmd(cmdS, &cmdE, "off")) {
bqn_exit(0);
} else if (isCmd(cmdS, &cmdE, "vars")) { } else if (isCmd(cmdS, &cmdE, "vars")) {
B r = listVars(gsc); B r = listVars(gsc);
if (q_N(r)) { if (q_N(r)) {