Command and prompt style can be modified
This commit is contained in:
@ -6,6 +6,11 @@ use NoccyLabs\Shell\LineRead;
|
||||
|
||||
abstract class Shell
|
||||
{
|
||||
|
||||
protected $promptStyle;
|
||||
|
||||
protected $commandStyle;
|
||||
|
||||
public function __construct(array $config=[])
|
||||
{
|
||||
$this->configure($config);
|
||||
@ -71,14 +76,26 @@ abstract class Shell
|
||||
{
|
||||
}
|
||||
|
||||
public function setPromptStyle($style)
|
||||
{
|
||||
$this->promptStyle = $style;
|
||||
}
|
||||
|
||||
public function setCommandStyle($style)
|
||||
{
|
||||
$this->commandStyle = $style;
|
||||
}
|
||||
|
||||
public function run()
|
||||
{
|
||||
$lineRead = new LineRead();
|
||||
|
||||
$lineRead->setCommandStyle($this->commandStyle);
|
||||
|
||||
$this->running = true;
|
||||
|
||||
do {
|
||||
$lineRead->setPrompt($this->getPrompt());
|
||||
$lineRead->setPrompt($this->getPrompt(), $this->promptStyle);
|
||||
$buffer = $lineRead->update();
|
||||
if ($buffer == "\x03") {
|
||||
$this->stop();
|
||||
|
Reference in New Issue
Block a user