當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Application::getHelp方法代碼示例

本文整理匯總了PHP中Symfony\Component\Console\Application::getHelp方法的典型用法代碼示例。如果您正苦於以下問題:PHP Application::getHelp方法的具體用法?PHP Application::getHelp怎麽用?PHP Application::getHelp使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Symfony\Component\Console\Application的用法示例。


在下文中一共展示了Application::getHelp方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: describeApplication

 /**
  * @inheritdoc
  */
 protected function describeApplication(ConsoleApplication $application, array $options = array())
 {
     $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
     $description = new ApplicationDescription($application, $describedNamespace);
     if (isset($options['raw_text']) && $options['raw_text']) {
         $width = $this->getColumnWidth($description->getCommands());
         foreach ($description->getCommands() as $command) {
             $this->writeText(sprintf("%-{$width}s %s", $command->getName(), $command->getDescription()), $options);
             $this->writeText("\n");
         }
     } else {
         $width = $this->getColumnWidth($description->getCommands());
         $this->writeText($application->getHelp(), $options);
         $this->writeText("\n\n");
         if ($describedNamespace) {
             $this->writeText(sprintf("<comment>Available commands for the \"%s\" namespace:</comment>", $describedNamespace), $options);
         } else {
             $this->writeText('<comment>Available commands:</comment>', $options);
         }
         // add commands by namespace
         foreach ($description->getNamespaces() as $namespace) {
             if (!$describedNamespace && ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
                 $this->writeText("\n");
                 $this->writeText('<comment>' . $namespace['id'] . '</comment>', $options);
             }
             foreach ($namespace['commands'] as $name) {
                 $command = $description->getCommand($name);
                 $aliases = $command->getAliases();
                 if ($aliases && in_array($name, $aliases)) {
                     // If the command is an alias, do not list it in the
                     // 'global' namespace. The aliases will be shown inline
                     // with the full command name.
                     continue;
                 }
                 if ($command instanceof PlatformCommand) {
                     $aliases = $command->getVisibleAliases();
                 }
                 // Colour local commands differently from remote ones.
                 $commandDescription = $command->getDescription();
                 if ($command instanceof PlatformCommand && !$command->isLocal()) {
                     $commandDescription = "<fg=cyan>{$commandDescription}</fg=cyan>";
                 }
                 $this->writeText("\n");
                 $this->writeText(sprintf("  %-{$width}s %s", "<info>{$name}</info>" . $this->formatAliases($aliases), $commandDescription), $options);
             }
         }
         $this->writeText("\n");
     }
 }
開發者ID:CompanyOnTheWorld,項目名稱:platformsh-cli,代碼行數:52,代碼來源:CustomTextDescriptor.php

示例2: getHelp

 /**
  * Gets the help message.
  *
  * It's a hack of the default help message to display the --shell
  * option only for the application and not for all the commands.
  *
  * @return string A help message.
  */
 public function getHelp()
 {
     // If we are already in a shell
     // we do not want to have the --shell option available
     if ($this->in_shell) {
         return parent::getHelp();
     }
     try {
         $definition = $this->getDefinition();
         $definition->addOption(new InputOption('--shell', '-s', InputOption::VALUE_NONE, $this->language->lang('CLI_DESCRIPTION_OPTION_SHELL')));
     } catch (\LogicException $e) {
         // Do nothing
     }
     return parent::getHelp();
 }
開發者ID:MrAdder,項目名稱:phpbb,代碼行數:23,代碼來源:application.php

示例3: describeApplication

 /**
  * {@inheritdoc}
  */
 protected function describeApplication(Application $application, array $options = [])
 {
     $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
     $description = new ApplicationDescription($application, $describedNamespace);
     if (isset($options['raw_text']) && $options['raw_text']) {
         $width = $this->getColumnWidth($description->getCommands());
         foreach ($description->getCommands() as $command) {
             $this->writeText(sprintf("%-{$width}s %s", $command->getName(), $command->getDescription()), $options);
             $this->writeText("\n");
         }
     } else {
         if ('' != ($help = $application->getHelp())) {
             $this->writeText("{$help}\n\n", $options);
         }
         $this->writeText("<comment>Usage:</comment>\n", $options);
         $this->writeText("  command [options] [arguments]\n\n", $options);
         $this->describeInputDefinition(new InputDefinition($application->getDefinition()->getOptions()), $options);
         $this->writeText("\n");
         $this->writeText("\n");
         $width = $this->getColumnWidth($description->getCommands());
         if ($describedNamespace) {
             $this->writeText(sprintf('<comment>Available commands for the "%s" namespace:</comment>', $describedNamespace), $options);
         } else {
             $this->writeText('<comment>Available commands:</comment>', $options);
         }
         // add commands by namespace
         foreach ($description->getNamespaces() as $namespace) {
             if ($this->shouldListCommand($namespace['id']) === false) {
                 continue;
             }
             if (!$describedNamespace && ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
                 $this->writeText("\n");
                 $this->writeText(' <comment>' . $namespace['id'] . '</comment>', $options);
             }
             foreach ($namespace['commands'] as $name) {
                 if ($this->shouldListCommand($namespace['id'], $name) === false) {
                     continue;
                 }
                 $this->writeText("\n");
                 $spacingWidth = $width - strlen($name);
                 $this->writeText(sprintf('  <info>%s</info>%s%s', $name, str_repeat(' ', $spacingWidth), $description->getCommand($name)->getDescription()), $options);
             }
         }
         $this->writeText("\n");
     }
 }
開發者ID:codex-project,項目名稱:develop,代碼行數:49,代碼來源:TextDescriptor.php

示例4: describeApplication

 /**
  * {@inheritdoc}
  */
 protected function describeApplication(Application $application, array $options = array())
 {
     $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
     $description = new ApplicationDescription($application, $describedNamespace);
     if (isset($options['raw_text']) && $options['raw_text']) {
         $width = $this->getColumnWidth($description->getCommands());
         foreach ($description->getCommands() as $command) {
             $this->writeText(sprintf("%-{$width}s %s", $command->getName(), $command->getDescription()), $options);
             $this->writeText("\n");
         }
     } else {
         if ('' != ($help = $application->getHelp())) {
             $this->writeText("{$help}\n\n", $options);
         }
         $this->describeInputDefinition(new InputDefinition($application->getDefinition()->getOptions()), $options);
         $this->writeText("\n");
         $this->writeText("\n");
         $width = $this->getColumnWidth($description->getCommands());
         if ($describedNamespace) {
             $this->writeText(sprintf('<comment>Available commands for the "%s" namespace:</comment>', $describedNamespace), $options);
         } else {
             $this->writeText('<comment>Available commands:</comment>', $options);
         }
         // add commands by namespace
         foreach ($description->getNamespaces() as $namespace) {
             if (!$describedNamespace && ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
                 $this->writeText("\n");
                 $this->writeText(' <comment>' . $namespace['id'] . '</comment>', $options);
             }
             foreach ($namespace['commands'] as $name) {
                 $command = $description->getCommand($name);
                 $aliases = $command->getAliases();
                 if ($aliases && in_array($name, $aliases)) {
                     // skip aliases
                     continue;
                 }
                 $this->writeText("\n");
                 $this->writeText(sprintf("  %-{$width}s %s", "<info>{$name}</info>" . $this->formatAliases($aliases), $command->getDescription()), $options);
             }
         }
         $this->writeText("\n");
     }
 }
開發者ID:mglaman,項目名稱:drupalorg-cli,代碼行數:46,代碼來源:CustomTextDescriptor.php

示例5: getHelp

    public function getHelp()
    {
        return parent::getHelp() . <<<'EOF'


<comment>Configuration:</comment>
  You can set configuration options in a <info>yaml</info> file named <info>.sugarclirc</info>.
  SugarCli will look for a <info>.sugarclirc</info> file in any of the parent folders of the current
  directory. The deepest file overrides the previous ones.

  The following options are available:
  <info>sugarcrm:
      path: PATH             </info>Path to Sugarcrm relative to the configuration file<info>
      user_id: USER_ID       </info>SugarCRM user id to impersonate when running the command<info>
  metadata:
      file: FILE             </info>Path to the metadata file relative to the configuration file<info>
  account:
      name: ACCOUNT_NAME     </info>Name of the account<info>
  </info>
EOF;
    }
開發者ID:inetprocess,項目名稱:sugarcli,代碼行數:21,代碼來源:Application.php

示例6: getHelp

 /**
  * @return string
  */
 public function getHelp()
 {
     return self::GUSH_LOGO . PHP_EOL . parent::getHelp();
 }
開發者ID:gushphp,項目名稱:gush,代碼行數:7,代碼來源:Application.php

示例7: getHelp

 /**
  * Get help
  *
  * @return string
  */
 public function getHelp()
 {
     return $this->logo . parent::getHelp();
 }
開發者ID:andkirby,項目名稱:commithook,代碼行數:9,代碼來源:Application.php

示例8: describeApplication

 /**
  * {@inheritdoc}
  */
 protected function describeApplication(Application $application, array $options = array())
 {
     $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
     $description = new ApplicationDescription($application, $describedNamespace);
     if (isset($options['raw_text']) && $options['raw_text']) {
         $width = $this->getColumnWidth($description->getCommands());
         foreach ($description->getCommands() as $command) {
             $this->writeText(sprintf("%-{$width}s %s", $command->getName(), $command->getDescription()), $options);
             $this->writeText("\n");
         }
     } else {
         $width = $this->getColumnWidth($description->getCommands());
         $this->writeText($application->getHelp(), $options);
         $this->writeText("\n\n");
         if ($describedNamespace) {
             $this->writeText(sprintf("<comment>Available commands for the \"%s\" namespace:</comment>", $describedNamespace), $options);
         } else {
             $this->writeText('<comment>Available commands:</comment>', $options);
         }
         // add commands by namespace
         foreach ($description->getNamespaces() as $namespace) {
             if (!$describedNamespace && ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
                 $this->writeText("\n");
                 $this->writeText('<comment>' . $namespace['id'] . '</comment>', $options);
             }
             foreach ($namespace['commands'] as $name) {
                 $this->writeText("\n");
                 $this->writeText(sprintf("  <info>%-{$width}s</info> %s", $name, $description->getCommand($name)->getDescription()), $options);
             }
         }
         $this->writeText("\n");
     }
 }
開發者ID:GeorgeBroadley,項目名稱:caffeine-vendor,代碼行數:36,代碼來源:TextDescriptor.php

示例9: getHelp

 public function getHelp()
 {
     return parent::getHelp();
 }
開發者ID:cpeter,項目名稱:php-cms-version-checker,代碼行數:4,代碼來源:Application.php

示例10: getHelp

 public function getHelp()
 {
     return self::LOGO . parent::getHelp();
 }
開發者ID:TomzxForks,項目名稱:melody,代碼行數:4,代碼來源:Application.php

示例11: describeApplication

 /**
  * {@inheritdoc}
  */
 protected function describeApplication(Application $application, array $options = array())
 {
     $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
     $description = new ApplicationDescription($application, $describedNamespace);
     if (isset($options['raw_text']) && $options['raw_text']) {
         $width = $this->getColumnWidth($description->getCommands());
         foreach ($description->getCommands() as $command) {
             $this->writeText(sprintf("%-{$width}s %s", $command->getName(), $command->getDescription()), $options);
             $this->writeText("\n");
         }
     } else {
         if ('' != ($help = $application->getHelp())) {
             $this->writeText("{$help}\n\n", $options);
         }
         $this->writeText($application->trans('commands.list.messages.usage'), $options);
         $this->writeText($application->trans('commands.list.messages.usage_details'), $options);
         $options['application'] = $application;
         $this->describeInputDefinition(new InputDefinition($application->getDefinition()->getOptions()), $options);
         $this->writeText("\n");
         $this->writeText("\n");
         $width = $this->getColumnWidth($description->getCommands());
         if ($describedNamespace) {
             $this->writeText(sprintf($application->trans('commands.list.messages.comment'), $describedNamespace), $options);
         } else {
             $this->writeText($application->trans('commands.list.messages.available-commands'), $options);
         }
         // add commands by namespace
         foreach ($description->getNamespaces() as $namespace) {
             if (!$describedNamespace && ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
                 $this->writeText("\n");
                 $this->writeText(' <comment>' . $namespace['id'] . '</comment>', $options);
             }
             foreach ($namespace['commands'] as $name) {
                 $this->writeText("\n");
                 $spacingWidth = $width - strlen($name);
                 $this->writeText(sprintf('  <info>%s</info>%s%s', $name, str_repeat(' ', $spacingWidth), $description->getCommand($name)->getDescription()), $options);
             }
         }
         $this->writeText("\n");
     }
 }
開發者ID:legovaer,項目名稱:DrupalConsole,代碼行數:44,代碼來源:TextDescriptor.php

示例12: getHelp

 /**
  * Get the header for the help message
  *
  * @return string
  */
 public function getHelp()
 {
     return parent::getHelp() . "\n" . "\n" . "Copyright (C) 2015  Tyler Romeo <tylerromeo@gmail.com>\n" . "This program is free software, and you are welcome to redistribute it\n" . "under certain conditions. It comes with ABSOLUTELY NO WARRANTY.\n" . "Run the 'license' command for details.";
 }
開發者ID:castlepointanime,項目名稱:brancher,代碼行數:9,代碼來源:Application.php

示例13: getHelp

 /**
  * {@inheritDoc}
  */
 public function getHelp()
 {
     return $this->getLogo() . parent::getHelp();
 }
開發者ID:jiabin,項目名稱:migraine,代碼行數:7,代碼來源:Application.php

示例14: getHelp

 public function getHelp()
 {
     return '<info>' . self::$logo . '</info>' . parent::getHelp();
 }
開發者ID:insulin,項目名稱:cli,代碼行數:4,代碼來源:Application.php

示例15: getHelp

 public function getHelp()
 {
     return parent::getHelp() . PHP_EOL . PHP_EOL . '<info>You must read the help. Run:</info> <comment>vendor/bin/migrator help migrate_xx</comment>';
 }
開發者ID:SergienkoOleg,項目名稱:Magento2-Data-Migration,代碼行數:4,代碼來源:Application.php


注:本文中的Symfony\Component\Console\Application::getHelp方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。