mirror of
https://github.com/sbrl/Pepperminty-Wiki.git
synced 2024-10-31 21:33:00 +00:00
Squash more bugs in feature-cli and populate readline history
This commit is contained in:
parent
0829e7630b
commit
f2561d8cb0
1 changed files with 11 additions and 3 deletions
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
register_module([
|
register_module([
|
||||||
"name" => "Command-line interface",
|
"name" => "Command-line interface",
|
||||||
"version" => "0.1",
|
"version" => "0.1.1",
|
||||||
"author" => "Starbeamrainbowlabs",
|
"author" => "Starbeamrainbowlabs",
|
||||||
"description" => "Allows interaction with Pepperminty Wiki on the command line.",
|
"description" => "Allows interaction with Pepperminty Wiki on the command line.",
|
||||||
"id" => "feature-cli",
|
"id" => "feature-cli",
|
||||||
|
@ -123,10 +123,18 @@ Be warned that you are effectively the superuser for your wiki right now, with c
|
||||||
|
|
||||||
while(true) {
|
while(true) {
|
||||||
$next_line = readline($settings->cli_prompt);
|
$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;
|
if(strlen($next_line) == 0) continue;
|
||||||
|
|
||||||
|
readline_add_history($next_line);
|
||||||
|
$exit_code = -1;
|
||||||
|
try {
|
||||||
$exit_code = cli_exec($next_line);
|
$exit_code = cli_exec($next_line);
|
||||||
|
}
|
||||||
|
catch (Exception $error) {
|
||||||
|
echo("***** Error *****\n");
|
||||||
|
echo($error);
|
||||||
|
}
|
||||||
echo("<<<< $exit_code <<<<\n");
|
echo("<<<< $exit_code <<<<\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue