6
6
use Symfony \Component \Console \Command \Command ;
7
7
use Symfony \Component \Console \Input \InputArgument ;
8
8
use Symfony \Component \Console \Input \InputInterface ;
9
+ use Symfony \Component \Console \Input \InputOption ;
9
10
use Symfony \Component \Console \Output \OutputInterface ;
10
11
11
12
class PhpCommand extends Command
@@ -16,13 +17,20 @@ protected function configure()
16
17
$ this ->setName ("php " );
17
18
$ this ->setDescription ("Runs the PHP CLI built from source " );
18
19
19
- $ this ->addArgument ("args " , InputArgument::IS_ARRAY | InputArgument::REQUIRED , "arguments to pass to the PHP CLI " );
20
+ $ this ->addOption ("info " , "-i " , InputOption::VALUE_NONE , "show PHP information " );
21
+
22
+ $ this ->addArgument ("args " , InputArgument::IS_ARRAY , "arguments to pass to the PHP CLI " );
20
23
}
21
24
22
25
protected function execute (InputInterface $ input , OutputInterface $ output )
23
26
{
27
+ $ arguments = $ input ->getArgument ('args ' );
28
+ if ($ input ->hasOption ('info ' )) {
29
+ $ arguments [] = '-i ' ;
30
+ }
31
+
24
32
$ dockerImage = new DockerImage ();
25
- $ process = $ dockerImage ->createProcess ('run-cli ' , $ input -> getArgument ( ' args ' ) );
33
+ $ process = $ dockerImage ->createProcess ('run-cli ' , $ arguments );
26
34
$ process ->setTimeout (null );
27
35
28
36
return ConsoleProcessBridge::runProcessFromConsole ($ process , $ input , $ output );
0 commit comments