From f2561d8cb09f8faf421c60a4d6306e9966567ecc Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Sun, 15 Mar 2020 17:19:16 +0000 Subject: [PATCH] Squash more bugs in feature-cli and populate readline history --- modules/feature-cli.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/modules/feature-cli.php b/modules/feature-cli.php index c0e9cf5..0765008 100644 --- a/modules/feature-cli.php +++ b/modules/feature-cli.php @@ -1,7 +1,7 @@ "Command-line interface", - "version" => "0.1", + "version" => "0.1.1", "author" => "Starbeamrainbowlabs", "description" => "Allows interaction with Pepperminty Wiki on the command line.", "id" => "feature-cli", @@ -123,10 +123,18 @@ Be warned that you are effectively the superuser for your wiki right now, with c while(true) { $next_line = readline($settings->cli_prompt); - if($next_line == false) { echo("\nexit\n"); exit(0); } + if($next_line === false) { echo("\nexit\n"); exit(0); } if(strlen($next_line) == 0) continue; - $exit_code = cli_exec($next_line); + readline_add_history($next_line); + $exit_code = -1; + try { + $exit_code = cli_exec($next_line); + } + catch (Exception $error) { + echo("***** Error *****\n"); + echo($error); + } echo("<<<< $exit_code <<<<\n"); } }