-
-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Single Command Applications #30
Comments
Why not, but how would the single command be defined? It sounds a bit vague for now. |
Please check #31 for an approach. |
Actually Symfony already provides support for that. I've needed that so I had a look, it's as simple as doing this: $app->command('run', /* ... */);
$app->setDefaultCommand('run'); I've added it to the documentation. |
If you want to use use Symfony\Component\Console\Output\OutputInterface;
$app = new Silly\Application();
$app->command( 'greet [name] [--yell]', function ( $name, $yell, OutputInterface $output ) {
if ( ! $yell ) {
return false;
}
$output->writeln( $name );
} );
$app->setDefaultCommand( 'greet', true ); // 2nd Parameter: bool $isSingleCommand = false
$app->run(); But then running the sub-command ...so you can't really have sub-commands (and them operate normally) when you make a single command (default) re-direct to a sub-command. |
I'd find it generally useful to let Silly support Single Command Applications out of the box.
A simple way of providing this might be offering a
Silly\SingleCommandApplication
.Respectively,
Silly\Edition\PhpDi\SingleCommandApplication
for PHP-DI.What do you think?
The text was updated successfully, but these errors were encountered: