Changed prompt management
This commit is contained in:
		@@ -28,11 +28,14 @@ class MyShell extends Shell
 | 
			
		||||
            echo "world\n\rthis\n\ris\n\ra\ntest\n\r";
 | 
			
		||||
        });
 | 
			
		||||
        $this->addCommand(new MyCommand());
 | 
			
		||||
        $this->updatePrompt();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected function getPrompt()
 | 
			
		||||
    
 | 
			
		||||
    protected function updatePrompt()
 | 
			
		||||
    {
 | 
			
		||||
        return "test[{$this->seq}]: ";
 | 
			
		||||
        $this->setPrompt("test[{$this->seq}]: ");
 | 
			
		||||
        $fg = ($this->seq % 7) + 1;
 | 
			
		||||
        $this->setPromptStyle("3{$fg}");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected function onUpdate()
 | 
			
		||||
@@ -43,13 +46,12 @@ class MyShell extends Shell
 | 
			
		||||
            $lt = $t + 5;
 | 
			
		||||
            echo date("Y-m-d h:i:s")."\n";
 | 
			
		||||
        }
 | 
			
		||||
        $fg = ($this->seq % 7) + 1;
 | 
			
		||||
        $this->setPromptStyle("3{$fg}");
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    protected function onCommand($buffer)
 | 
			
		||||
    {
 | 
			
		||||
        $this->seq++;
 | 
			
		||||
        $this->updatePrompt();
 | 
			
		||||
        parent::onCommand($buffer);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user