getHelp() публичный метод

Gets the help message.
public getHelp ( ) : string
Результат string A help message
Пример #1
0
 /**
  * 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();
     }
     $this->getDefinition()->addOption(new InputOption('--shell', '-s', InputOption::VALUE_NONE, $this->user->lang('CLI_DESCRIPTION_OPTION_SHELL')));
     return parent::getHelp();
 }
 /**
  * @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");
     }
 }
Пример #3
0
 /**
  * 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();
 }
Пример #4
0
 /**
  * {@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");
     }
 }
 /**
  * {@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");
     }
 }
Пример #6
0
    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;
    }
Пример #7
0
 /**
  * @return string
  */
 public function getHelp()
 {
     return self::GUSH_LOGO . PHP_EOL . parent::getHelp();
 }
Пример #8
0
 /**
  * Get help
  *
  * @return string
  */
 public function getHelp()
 {
     return $this->logo . parent::getHelp();
 }
 /**
  * {@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");
     }
 }
Пример #10
0
 public function getHelp()
 {
     return parent::getHelp();
 }
Пример #11
0
 public function getHelp()
 {
     return self::LOGO . parent::getHelp();
 }
Пример #12
0
 /**
  * {@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");
     }
 }
Пример #13
0
 /**
  * Get the header for the help message
  *
  * @return string
  */
 public function getHelp()
 {
     return parent::getHelp() . "\n" . "\n" . "Copyright (C) 2015  Tyler Romeo <*****@*****.**>\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.";
 }
Пример #14
0
 /**
  * {@inheritDoc}
  */
 public function getHelp()
 {
     return $this->getLogo() . parent::getHelp();
 }
Пример #15
0
 public function getHelp()
 {
     return '<info>' . self::$logo . '</info>' . parent::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>';
 }
Пример #17
0
 /**
  * Returns the help message.
  *
  * @return string
  */
 public function getHelp()
 {
     return Accompli::LOGO . parent::getHelp();
 }
Пример #18
0
 public function testHelp()
 {
     $application = new Application();
     $this->assertStringEqualsFile(self::$fixturesPath . '/application_gethelp.txt', str_replace(PHP_EOL, "\n", $application->getHelp()), '->setHelp() returns a help message');
 }
Пример #19
0
 /**
  * Get help string
  *
  * @return string
  */
 public function getHelp()
 {
     return static::$logo . parent::getHelp();
 }
Пример #20
0
 public function getHelp()
 {
     return self::$logo . parent::getHelp();
 }
Пример #21
0
 public function getHelp()
 {
     return self::$logo . \Symfony\Component\Console\Application::getHelp();
 }
Пример #22
0
 /**
  * {@inheritDoc}
  *
  * @codeCoverageIgnore
  */
 public function getHelp()
 {
     return "\n" . self::$logo . "\n\n" . parent::getHelp();
 }
 /**
  * {@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("<comment>Usage:</comment>\n", $options);
         $this->writeText(" [options] command [arguments]\n\n", $options);
         $this->writeText('<comment>Options:</comment>', $options);
         $inputOptions = $application->getDefinition()->getOptions();
         $width = 0;
         foreach ($inputOptions as $option) {
             $nameLength = strlen($option->getName()) + 2;
             if ($option->getShortcut()) {
                 $nameLength += strlen($option->getShortcut()) + 3;
             }
             $width = max($width, $nameLength);
         }
         ++$width;
         foreach ($inputOptions as $option) {
             $this->writeText("\n", $options);
             $this->describeInputOption($option, array_merge($options, array('name_width' => $width)));
         }
         $this->writeText("\n\n", $options);
         $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) {
                 $this->writeText("\n");
                 $this->writeText(sprintf(" <info>%-{$width}s</info> %s", $name, $description->getCommand($name)->getDescription()), $options);
             }
         }
         $this->writeText("\n");
     }
 }
 /**
  * @inheritdoc
  */
 protected function describeApplication(ConsoleApplication $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 {
         $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);
         }
         // Display commands grouped by namespace.
         foreach ($description->getNamespaces() as $namespace) {
             // Filter hidden commands in the namespace.
             /** @var Command[] $commands */
             $commands = [];
             foreach ($namespace['commands'] as $name) {
                 $command = $description->getCommand($name);
                 if (!$describedNamespace && $command instanceof CanHideInListInterface && $command->hideInList()) {
                     continue;
                 }
                 $commands[$name] = $command;
             }
             // Skip the namespace if it doesn't contain any commands.
             if (!count($commands)) {
                 continue;
             }
             // Display the namespace name.
             if (!$describedNamespace && ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
                 $this->writeText("\n");
                 $this->writeText('<comment>' . $namespace['id'] . '</comment>', $options);
             }
             // Display each command.
             foreach ($commands as $name => $command) {
                 $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 CommandBase) {
                     $aliases = $command->getVisibleAliases();
                 }
                 // Colour local commands differently from remote ones.
                 $commandDescription = $command->getDescription();
                 if ($command instanceof CommandBase && !$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");
     }
 }
Пример #25
0
 /**
  * Return info Help
  * @return string
  */
 public function getHelp()
 {
     return self::getLogo() . PHP_EOL . parent::getHelp();
 }
Пример #26
0
 /**
  * {@inheritdoc}
  */
 protected function describeApplication(Application $application, array $options = array())
 {
     $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
     $description = new ApplicationDescription($application, $describedNamespace);
     $messages = array();
     if (isset($options['raw_text']) && $options['raw_text']) {
         $width = $this->getColumnWidth($description->getCommands());
         foreach ($description->getCommands() as $command) {
             $messages[] = sprintf("%-{$width}s %s", $command->getName(), $command->getDescription());
         }
     } else {
         $width = $this->getColumnWidth($description->getCommands());
         $messages[] = $application->getHelp();
         $messages[] = '';
         if ($describedNamespace) {
             $messages[] = sprintf("<comment>Available commands for the \"%s\" namespace:</comment>", $describedNamespace);
         } else {
             $messages[] = '<comment>Available commands:</comment>';
         }
         // add commands by namespace
         foreach ($description->getNamespaces() as $namespace) {
             if (!$describedNamespace && ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
                 $messages[] = '<comment>' . $namespace['id'] . '</comment>';
             }
             foreach ($namespace['commands'] as $name) {
                 $messages[] = sprintf("  <info>%-{$width}s</info> %s", $name, $description->getCommand($name)->getDescription());
             }
         }
     }
     $output = implode("\n", $messages);
     return isset($options['raw_text']) && $options['raw_text'] ? strip_tags($output) : $output;
 }
Пример #27
0
 public function testHelp()
 {
     $application = new Application();
     $this->assertStringEqualsFile(self::$fixturesPath . '/application_gethelp.txt', $this->normalizeLineBreaks($application->getHelp()), '->getHelp() returns a help message');
 }
 public function getHelp()
 {
     return Application::LOGO . parent::getHelp();
 }