From 26c12e6724a8b9545a2909cd8b6390a0f757da9b Mon Sep 17 00:00:00 2001 From: dzaima Date: Sat, 7 Jan 2023 02:22:19 +0200 Subject: [PATCH] add )exit & )off --- docs/commands.md | 4 ++++ src/main.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/docs/commands.md b/docs/commands.md index 6316aee0..345f8842 100644 --- a/docs/commands.md +++ b/docs/commands.md @@ -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. +## `)exit` / `)off` + +Equivalent to `•Exit 0` + ## `)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. diff --git a/src/main.c b/src/main.c index 703ca577..a77bc859 100644 --- a/src/main.c +++ b/src/main.c @@ -592,6 +592,8 @@ void cbqn_runLine0(char* ln, i64 read) { else printf("Unknown theme\n"); return; #endif + } else if (isCmd(cmdS, &cmdE, "exit") || isCmd(cmdS, &cmdE, "off")) { + bqn_exit(0); } else if (isCmd(cmdS, &cmdE, "vars")) { B r = listVars(gsc); if (q_N(r)) {