File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77use Symfony \Component \Console \Attribute \AsCommand ;
88use Symfony \Component \Console \Command \Command ;
99use Symfony \Component \Console \Input \InputInterface ;
10+ use Symfony \Component \Console \Input \InputOption ;
1011use Symfony \Component \Console \Output \OutputInterface ;
1112
1213#[AsCommand('list:enabled-tools ' , 'Lists enabled tools (in JSON). ' )]
1314final class ListToolsCommand extends Command
1415{
1516 public function __construct (
16- private Configuration $ configuration ,
17+ private readonly Configuration $ configuration ,
1718 ) {
1819 parent ::__construct ();
1920 }
2021
22+ protected function configure (): void
23+ {
24+ $ this ->addOption (
25+ 'working-dir ' ,
26+ null ,
27+ InputOption::VALUE_OPTIONAL ,
28+ 'Working directory, relative to project root. ' ,
29+ );
30+ }
31+
32+ protected function initialize (InputInterface $ input , OutputInterface $ output ): void
33+ {
34+ if (null === $ workingDir = $ input ->getOption ('working-dir ' )) {
35+ return ;
36+ }
37+
38+ \assert (\is_string ($ workingDir ));
39+
40+ $ this ->configuration ->setWorkingDir ($ workingDir );
41+ }
42+
2143 protected function execute (InputInterface $ input , OutputInterface $ output ): int
2244 {
2345 $ output ->write (\json_encode (\array_keys ($ this ->configuration ->getEnabledTools ()), \JSON_THROW_ON_ERROR ));
You can’t perform that action at this time.
0 commit comments