client = new RokuClient(); $this->hostname = $this->client->GetFriendlyName(); $this->aPathStack = array(); } function getPromptString(){ return $this->hostname.":".$this->getPathString().'$ '; } function getPathString(){ return "/".implode( "/", $this->aPathStack ); } function ls( $args ){ $aListDir = $this->aPathStack; } /** * Read from the command line and parse commands */ function read(){ $line = prompt( $this->getPromptString() ); $line = trim( $line ); if( $line != "" ){ preg_match( "/([^ ]+) ?(.*)/", $line, $m ); if( isset( $m[2] ) ) $args = $m[2]; else $args = ""; switch( $m[1] ){ case "ls": case "cd": case "q": if( method_exists( $this, $m[1] ) ) $this->$m[1]( $args ); break; } } $this->read(); } } ?>