本文整理汇总了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");
}
}
示例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();
}
示例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");
}
}
示例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");
}
}
示例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;
}
示例6: getHelp
/**
* @return string
*/
public function getHelp()
{
return self::GUSH_LOGO . PHP_EOL . parent::getHelp();
}
示例7: getHelp
/**
* Get help
*
* @return string
*/
public function getHelp()
{
return $this->logo . parent::getHelp();
}
示例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");
}
}
示例9: getHelp
public function getHelp()
{
return parent::getHelp();
}
示例10: getHelp
public function getHelp()
{
return self::LOGO . parent::getHelp();
}
示例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");
}
}
示例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.";
}
示例13: getHelp
/**
* {@inheritDoc}
*/
public function getHelp()
{
return $this->getLogo() . parent::getHelp();
}
示例14: getHelp
public function getHelp()
{
return '<info>' . self::$logo . '</info>' . parent::getHelp();
}
示例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>';
}