Add example Symfony Console application
This commit is contained in:
parent
a8defd7eae
commit
d415966d94
5 changed files with 757 additions and 0 deletions
20
nix/composer2nix/index.php
Normal file
20
nix/composer2nix/index.php
Normal file
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
// https://symfony.com/doc/current/components/console/single_command_tool.html
|
||||
|
||||
require __DIR__.'/vendor/autoload.php';
|
||||
|
||||
use Symfony\Component\Console\Attribute\Argument;
|
||||
use Symfony\Component\Console\Attribute\Option;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\SingleCommandApplication;
|
||||
|
||||
(new SingleCommandApplication())
|
||||
->setName('My Super Command') // Optional
|
||||
->setVersion('1.0.0') // Optional
|
||||
->setCode(function (OutputInterface $output, #[Argument] string $foo = 'The directory', #[Option] string $bar = ''): int {
|
||||
// output arguments and options
|
||||
|
||||
return 0;
|
||||
})
|
||||
->run();
|
Loading…
Add table
Add a link
Reference in a new issue