From 4800cf0cf68218f78ea7c8c4338718763cde9645 Mon Sep 17 00:00:00 2001 From: inhere Date: Sun, 24 Jan 2021 17:10:47 +0800 Subject: [PATCH] update some for ishell env --- src/AbstractApplication.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/AbstractApplication.php b/src/AbstractApplication.php index 156013d..38b97ae 100644 --- a/src/AbstractApplication.php +++ b/src/AbstractApplication.php @@ -426,10 +426,23 @@ protected function startInteractiveShell(): void }); } + $exitKeys = [ + 'q' => 1, + 'quit' => 1, + 'exit' => 1, + ]; + while (true) { $line = Interact::readln('CMD > '); - if ($line === 'exit' || $line === 'quit') { - break; + if (strlen($line) < 5) { + if (isset($exitKeys[$line])) { + break; + } + + // "?" as show help + if ($line === '?') { + $line = 'help'; + } } if ($hasPcntl) { @@ -444,6 +457,7 @@ protected function startInteractiveShell(): void // \vdump($in); $this->run(false); + $out->println(''); } $out->colored("\nQuit. ByeBye!");