1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:17:44 +00:00

js: Output text using printf() and return undefined in help()

This commit is contained in:
Linus Groh 2020-04-13 21:08:54 +01:00 committed by Andreas Kling
parent c8edcf1d71
commit 8e08d111da

View file

@ -301,15 +301,13 @@ JS::Value ReplObject::exit_interpreter(JS::Interpreter& interpreter)
return JS::js_undefined(); return JS::js_undefined();
} }
JS::Value ReplObject::repl_help(JS::Interpreter& interpreter) JS::Value ReplObject::repl_help(JS::Interpreter&)
{ {
StringBuilder help_text; printf("REPL commands:\n");
help_text.append("REPL commands:\n"); printf(" exit(code): exit the REPL with specified code. Defaults to 0.\n");
help_text.append(" exit(code): exit the REPL with specified code. Defaults to 0.\n"); printf(" help(): display this menu\n");
help_text.append(" help(): display this menu\n"); printf(" load(files): Accepts file names as params to load into running session. For example load(\"js/1.js\", \"js/2.js\", \"js/3.js\")\n");
help_text.append(" load(files): Accepts file names as params to load into running session. For example repl.load(\"js/1.js\", \"js/2.js\", \"js/3.js\")\n"); return JS::js_undefined();
String result = help_text.to_string();
return js_string(interpreter, result);
} }
JS::Value ReplObject::load_file(JS::Interpreter& interpreter) JS::Value ReplObject::load_file(JS::Interpreter& interpreter)