当前位置: 首页>>代码示例>>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;未经允许,请勿转载。