@@ -5,6 +5,7 @@ use Symfony\Component\Console\Command\Command;
5
5
use Symfony \Component \Console \Helper \Table ;
6
6
use Symfony \Component \Console \Input \InputArgument ;
7
7
use Symfony \Component \Console \Input \InputInterface ;
8
+ use Symfony \Component \Console \Input \InputOption ;
8
9
use Symfony \Component \Console \Output \OutputInterface ;
9
10
use Symfony \Component \Console \SingleCommandApplication ;
10
11
use Symfony \Component \Console \Style \SymfonyStyle ;
@@ -20,6 +21,7 @@ require_once __DIR__ . '/vendor/autoload.php';
20
21
$ app = (new SingleCommandApplication ('Symfony AI Example Runner ' ))
21
22
->setDescription ('Runs all Symfony AI examples in folder examples/ ' )
22
23
->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". ' )
23
25
->setCode (function (InputInterface $ input , OutputInterface $ output ) {
24
26
$ io = new SymfonyStyle ($ input , $ output );
25
27
$ io ->title ('Symfony AI Examples ' );
@@ -34,9 +36,14 @@ $app = (new SingleCommandApplication('Symfony AI Example Runner'))
34
36
}
35
37
}
36
38
39
+ $ filter = '*.php ' ;
40
+ if (null !== $ additionalFilter = $ input ->getOption ('filter ' )) {
41
+ $ filter = sprintf ('*%s*.php ' , $ additionalFilter );
42
+ }
43
+
37
44
$ examples = (new Finder ())
38
45
->in ($ directory )
39
- ->name (' *.php ' )
46
+ ->name ($ filter )
40
47
->exclude ('vendor ' )
41
48
->sortByName ()
42
49
->files ();
0 commit comments