From cbabaef668911abc6e12e82be70a205cd8f9051e Mon Sep 17 00:00:00 2001 From: SingularityT3 <44658109+SingularityT3@users.noreply.github.com> Date: Sat, 30 Mar 2024 14:03:44 +0530 Subject: [PATCH] Help menu --- src/launch/repl.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/launch/repl.cpp b/src/launch/repl.cpp index 62604c1..6ebc747 100644 --- a/src/launch/repl.cpp +++ b/src/launch/repl.cpp @@ -20,7 +20,7 @@ static const std::string multilineKeywords[] = { }; bool startREPL() { - std::cout << "PseudoEngine2 v" << PseudoEngine2_VERSION_MAJOR << '.' << PseudoEngine2_VERSION_MINOR << '.' << PseudoEngine2_VERSION_PATCH << " REPL\nEnter 'EXIT' to quit\n"; + std::cout << "PseudoEngine2 v" << PseudoEngine2_VERSION_MAJOR << '.' << PseudoEngine2_VERSION_MINOR << '.' << PseudoEngine2_VERSION_PATCH << " REPL\nEnter '?' for help, 'EXIT' to quit\n"; Lexer lexer; Parser parser; @@ -32,8 +32,12 @@ bool startREPL() { size_t size = code.size(); if (size == 0) continue; - if (code == "EXIT") break; - if (code.starts_with("RUNFILE")) { + if (code == "?") { + std::cout << "Visit https://github.com/SingularityT3/PseudoEngine2 for syntax, examples and more info\nUse `RUNFILE ` to run programs stored in files" << std::endl; + continue; + } else if (code == "EXIT") { + break; + } else if (code.starts_with("RUNFILE")) { if (size < 9) { std::cerr << "Expected filename" << std::endl; continue; @@ -45,10 +49,10 @@ bool startREPL() { } REPLMode = false; - std::cout << "Running file " << psfilename << "\n"; + std::cout << "==> Running file '" << psfilename << "'\n"; std::string exit = runFile() ? "successfully" : "with an error"; - std::cout << "\nProgram exited " << exit << "\n"; - + std::cout << "\n==> Program exited " << exit << "\n"; + psfilename = ""; REPLMode = true; continue;