Prompt can now be set before linereader is created
This commit is contained in:
		@@ -19,6 +19,8 @@ class Shell
 | 
			
		||||
    
 | 
			
		||||
    protected $timers = [];
 | 
			
		||||
 | 
			
		||||
    protected $prompt = ">";
 | 
			
		||||
 | 
			
		||||
    public function __construct()
 | 
			
		||||
    {
 | 
			
		||||
        $this->configure();
 | 
			
		||||
@@ -162,10 +164,11 @@ class Shell
 | 
			
		||||
 | 
			
		||||
    public function setPrompt($text)
 | 
			
		||||
    {
 | 
			
		||||
        if (!$this->lineReader) {
 | 
			
		||||
            return;
 | 
			
		||||
        $this->prompt = $text;
 | 
			
		||||
    
 | 
			
		||||
        if ($this->lineReader) {
 | 
			
		||||
            $this->lineReader->setPromptText($text);
 | 
			
		||||
        }
 | 
			
		||||
        $this->lineReader->setPromptText($text);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -314,7 +317,7 @@ class Shell
 | 
			
		||||
    {
 | 
			
		||||
        $this->lineReader = new LineRead();
 | 
			
		||||
 | 
			
		||||
        $this->lineReader->setPromptText("shell>");
 | 
			
		||||
        $this->lineReader->setPromptText($this->prompt);
 | 
			
		||||
        $this->lineReader->setPromptStyle(new Style(Style::BR_GREEN));
 | 
			
		||||
        $this->lineReader->setCommandStyle(new Style(Style::GREEN));
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user