@@ -5,6 +5,7 @@ use Symfony\Component\Console\Command\Command;
55use Symfony \Component \Console \Helper \Table ;
66use Symfony \Component \Console \Input \InputArgument ;
77use Symfony \Component \Console \Input \InputInterface ;
8+ use Symfony \Component \Console \Input \InputOption ;
89use Symfony \Component \Console \Output \OutputInterface ;
910use Symfony \Component \Console \SingleCommandApplication ;
1011use Symfony \Component \Console \Style \SymfonyStyle ;
@@ -20,6 +21,7 @@ require_once __DIR__ . '/vendor/autoload.php';
2021$ app = (new SingleCommandApplication ('Symfony AI Example Runner ' ))
2122 ->setDescription ('Runs all Symfony AI examples in folder examples/ ' )
2223 ->addArgument ('subdirectory ' , InputArgument::OPTIONAL , 'Subdirectory to run examples from, e.g. "anthropic" or "huggingface". ' )
24+ ->addOption ('filter ' , 'f ' , InputOption::VALUE_REQUIRED , 'Filter examples by name, e.g. "audio" or "toolcall". ' )
2325 ->setCode (function (InputInterface $ input , OutputInterface $ output ) {
2426 $ io = new SymfonyStyle ($ input , $ output );
2527 $ io ->title ('Symfony AI Examples ' );
@@ -34,9 +36,14 @@ $app = (new SingleCommandApplication('Symfony AI Example Runner'))
3436 }
3537 }
3638
39+ $ filter = '*.php ' ;
40+ if (null !== $ additionalFilter = $ input ->getOption ('filter ' )) {
41+ $ filter = sprintf ('*%s*.php ' , $ additionalFilter );
42+ }
43+
3744 $ examples = (new Finder ())
3845 ->in ($ directory )
39- ->name (' *.php ' )
46+ ->name ($ filter )
4047 ->exclude ('vendor ' )
4148 ->sortByName ()
4249 ->files ();
0 commit comments