Skip to content

Commit

Permalink
bug #18556 [FrameworkBundle] Better output for user in ContainerDebug…
Browse files Browse the repository at this point in the history
…Command (JhonnyL)

This PR was merged into the 3.0 branch.

Discussion
----------

[FrameworkBundle] Better output for user in ContainerDebugCommand

| Q             | A
| ------------- | ---
| Branch?       | 3.0
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

Right now, the message `To search for a specific service, re-run this command with a search term. (e.g. debug:container log)` is displayed to the user whenever the command is being run. (Except when the search term is given).

But if a user runs e.g. `debug:container --parameters`. This message is out of scope since the user is looking for information about parameters, not services.

This PR will update the command to give better output to the user.

`debug:container`
Will keep current behaviour
`debug:container --parameters`
Will hint how to search for specific parameter
`debug:container --tags`
Will hint how to search for specific tag

Commits
-------

313d8b1 [FrameworkBundle] Better output for user in ContainerDebugCommand
  • Loading branch information
nicolas-grekas committed Apr 20, 2016
2 parents 76f3eae + 313d8b1 commit 2a47edc
Showing 1 changed file with 8 additions and 2 deletions.
Expand Up @@ -121,8 +121,14 @@ protected function execute(InputInterface $input, OutputInterface $output)
$options['output'] = $io;
$helper->describe($output, $object, $options);

if (!$input->getArgument('name') && $input->isInteractive()) {
$io->comment('To search for a specific service, re-run this command with a search term. (e.g. <comment>debug:container log</comment>)');
if (!$input->getArgument('name') && !$input->getOption('tag') && !$input->getOption('parameter') && $input->isInteractive()) {
if ($input->getOption('tags')) {
$io->comment('To search for a specific tag, re-run this command with a search term. (e.g. <comment>debug:container --tag=form.type</comment>)');
} elseif ($input->getOption('parameters')) {
$io->comment('To search for a specific parameter, re-run this command with a search term. (e.g. <comment>debug:container --parameter=kernel.debug</comment>)');
} else {
$io->comment('To search for a specific service, re-run this command with a search term. (e.g. <comment>debug:container log</comment>)');
}
}
}

Expand Down

0 comments on commit 2a47edc

Please sign in to comment.