Skip to content

Commit

Permalink
[Console] added a way to create console application with only 1 command
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Jul 1, 2010
1 parent aaa6aba commit 99952c6
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/Symfony/Components/Console/Application.php
Expand Up @@ -143,7 +143,7 @@ public function run(InputInterface $input = null, OutputInterface $output = null
*/
public function doRun(InputInterface $input, OutputInterface $output)
{
$name = $input->getFirstArgument('command');
$name = $this->getCommandName($input);

if (true === $input->hasParameterOption(array('--ansi', '-a'))) {
$output->setDecorated(true);
Expand Down Expand Up @@ -709,7 +709,12 @@ public function renderException($e, $output)
}
}

private function sortCommands($commands)
protected function getCommandName(InputInterface $input)
{
return $input->getFirstArgument('command');
}

protected function sortCommands($commands)
{
$namespacedCommands = array();
foreach ($commands as $name => $command) {
Expand All @@ -730,7 +735,7 @@ private function sortCommands($commands)
return $namespacedCommands;
}

private function getAbbreviationSuggestions($abbrevs)
protected function getAbbreviationSuggestions($abbrevs)
{
return sprintf('%s, %s%s', $abbrevs[0], $abbrevs[1], count($abbrevs) > 2 ? sprintf(' and %d more', count($abbrevs) - 2) : '');
}
Expand Down

0 comments on commit 99952c6

Please sign in to comment.