From 8fda3f8336ee65f0903f04e13e74c4348a707515 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Fri, 3 Aug 2018 09:24:25 -0400 Subject: [PATCH] Add a help command. --- src/Semantic/REPL.hs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Semantic/REPL.hs b/src/Semantic/REPL.hs index bfa63b3af..4acab36ad 100644 --- a/src/Semantic/REPL.hs +++ b/src/Semantic/REPL.hs @@ -121,10 +121,18 @@ step blobs recur term = do path <- asks modulePath span <- ask maybe (pure ()) (\ blob -> output (showExcerpt True span blob "")) (Prelude.lookup path blobs) + help = do + output "Commands available from the prompt:" + output "" + output " :help, :? display this list of commands" + output " :list show the source code around current breakpoint" + output " :step single-step after stopping at a breakpoint" runCommand run ":step" = run runCommand run ":list" = list >> runCommands run + runCommand run ":help" = help >> runCommands run + runCommand run ":?" = help >> runCommands run runCommand run s | all isSpace s = runCommands run - runCommand run other = output ("unknown command '" <> other <> "'") >> runCommands run + runCommand run other = output ("unknown command '" <> other <> "'") >> output "use :? for help" >> runCommands run runCommands run = do str <- prompt runCommand run str