示例#1
0
 /**
  * Your main program
  *
  * Arguments and options have been parsed when this is run
  *
  * @param DokuCLI_Options $options
  * @return void
  */
 protected function main(DokuCLI_Options $options)
 {
     $this->force = $options->getOpt('force', false);
     $this->username = $options->getOpt('user', $this->getUser());
     $command = $options->getCmd();
     switch ($command) {
         case 'checkout':
             $wiki_id = array_shift($options->args);
             $localfile = array_shift($options->args);
             $this->commandCheckout($wiki_id, $localfile);
             break;
         case 'commit':
             $localfile = array_shift($options->args);
             $wiki_id = array_shift($options->args);
             $this->commandCommit($localfile, $wiki_id, $options->getOpt('message', ''), $options->getOpt('trivial', false));
             break;
         case 'lock':
             $wiki_id = array_shift($options->args);
             $this->obtainLock($wiki_id);
             $this->success("{$wiki_id} locked");
             break;
         case 'unlock':
             $wiki_id = array_shift($options->args);
             $this->clearLock($wiki_id);
             $this->success("{$wiki_id} unlocked");
             break;
         default:
             echo $options->help();
     }
 }
示例#2
0
 /**
  * Your main program
  *
  * Arguments and options have been parsed when this is run
  *
  * @param DokuCLI_Options $options
  * @return void
  */
 protected function main(DokuCLI_Options $options)
 {
     $command = $options->getCmd();
     if (!$command) {
         $command = array_shift($options->args);
     }
     switch ($command) {
         case '':
             echo $options->help();
             break;
         case 'clone':
             $this->cmd_clone($options->args);
             break;
         case 'install':
             $this->cmd_install($options->args);
             break;
         case 'repo':
         case 'repos':
             $this->cmd_repos();
             break;
         default:
             $this->cmd_git($command, $options->args);
     }
 }