コード例 #1
0
 public function testCanAddMultipleFlag()
 {
     $command = new Command('ls');
     $command->addFlag(new Flag('l'));
     $command->addFlag(new Flag('a'));
     $this->assertEquals('ls -l -a', (string) $command, 'Command should have multiple flags');
 }
コード例 #2
0
 /**
  * @return bool
  */
 public function checkLibaryIsInstalled()
 {
     $shell = new Exec();
     $command = new Command($this->binaryPath);
     $command->addFlag(new Command\Flag('version'));
     $shell->run($command);
     if ($shell->getReturnValue() === 0) {
         return true;
     }
     return false;
 }
コード例 #3
0
ファイル: CommandService.php プロジェクト: pygillier/piTitle
 /**
  * Execute FB command to display provided file
  *
  * @param $file Absolute path to the file to display.
  * @return bool If command was successful or not
  */
 public function publish($file)
 {
     $sudo = $this->_config['use_sudo'] ? "sudo " : "";
     $command = new Command($sudo . $this->_config['bin_path']);
     // Flags
     foreach ($this->_config['flags'] as $flag) {
         $command->addFlag(new Flag($flag));
     }
     $command->addParam(new Param($file));
     if ($this->_shell->run($command)) {
         $this->setStatusFile($file);
         return true;
     }
     return false;
 }