Пример #1
0
 /**
  * @see	\wcf\system\cli\command\ICLICommand::execute()
  */
 public function execute(array $parameters)
 {
     $this->argv->setArguments($parameters);
     $this->argv->parse();
     $args = $this->argv->getRemainingArgs();
     // validate parameters
     if (count($args) != 1) {
         throw new ArgvException('', $this->getUsage());
     }
     $commands = CLICommandHandler::getCommands();
     if (!isset($commands[$args[0]])) {
         throw new ArgvException(CLIWCF::getLanguage()->getDynamicVariable('wcf.cli.error.command.notFound', array('command' => $args[0])), $this->getUsage());
     }
     $command = $commands[$args[0]];
     if (!$command instanceof IArgumentedCLICommand) {
         throw new ArgvException(CLIWCF::getLanguage()->getDynamicVariable('wcf.cli.error.help.noArguments', array('command' => $args[0])), $this->getUsage());
     }
     CLIWCF::getReader()->println($command->getUsage());
 }
Пример #2
0
 /**
  * @see	\wcf\system\cli\command\ICLICommand::execute()
  */
 public function execute(array $parameters)
 {
     CLIWCF::getReader()->println(CLIUtil::generateList(array_keys(CLICommandHandler::getCommands())));
 }
 /**
  * Creates a new instance of CLICommandNameCompleter.
  */
 public function __construct()
 {
     $this->commands = array_keys(CLICommandHandler::getCommands());
 }