File tree Expand file tree Collapse file tree 4 files changed +61
-12
lines changed
Expand file tree Collapse file tree 4 files changed +61
-12
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+ namespace PHPJava \Console \Commands \JVM ;
3+
4+ use Symfony \Component \Console \Command \Command ;
5+ use Symfony \Component \Console \Input \InputArgument ;
6+ use Symfony \Component \Console \Input \InputInterface ;
7+ use Symfony \Component \Console \Input \InputOption ;
8+ use Symfony \Component \Console \Output \OutputInterface ;
9+
10+ class RunCommand extends Command
11+ {
12+ protected static $ defaultName = 'jvm:run ' ;
13+
14+ protected function configure ()
15+ {
16+ $ this
17+ ->setDescription ('Run JVM ' )
18+ ->addOption (
19+ 'options ' ,
20+ 'o ' ,
21+ InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY ,
22+ 'Set options '
23+ )
24+ ->addOption (
25+ 'mode ' ,
26+ 'm ' ,
27+ InputOption::VALUE_OPTIONAL ,
28+ 'Set run mode [jar|class]. Default is class. '
29+ )
30+ ->addOption (
31+ 'entrypoint ' ,
32+ 'e ' ,
33+ InputOption::VALUE_OPTIONAL ,
34+ 'Overwrite entrypoint '
35+ )
36+ ->addArgument (
37+ 'parameters ' ,
38+ InputArgument::OPTIONAL | InputArgument::IS_ARRAY ,
39+ 'Define parameters to pass for entrypoint. '
40+ );
41+ }
42+
43+ protected function execute (InputInterface $ input , OutputInterface $ output )
44+ {
45+ $ options = $ input ->getOptions ();
46+ }
47+ }
Original file line number Diff line number Diff line change 11<?php
2+ namespace PHPJava \Console ;
23
4+ use PHPJava \Console \Commands \JVM \RunCommand ;
35use PHPJava \Core \JavaArchive ;
46use PHPJava \Core \PHPJava ;
7+ use Symfony \Component \Console \Application ;
58
69require __DIR__ . '/../vendor/autoload.php ' ;
710
8- if (!isset ($ argv [1 ])) {
9- echo "First parameter is needed. \n" ;
10- return ;
11- }
12-
13- $ jar = new JavaArchive ($ argv [1 ]);
14- $ arguments = array_slice ($ argv , 2 );
15- $ jar ->execute (...(array_slice ($ argv , 2 ) ?: [[]]));
11+ $ application = new Application ();
12+ $ runCommand = new RunCommand ();
13+ $ application ->add ($ runCommand );
14+ $ application ->setDefaultCommand ($ runCommand ->getName ());
15+ $ application ->run ();
Original file line number Diff line number Diff line change 33 "description" : " JVM emulator by PHP" ,
44 "type" : " library" ,
55 "license" : " MIT" ,
6- "version" : " 0.0.6.5 -dev" ,
6+ "version" : " 0.0.6.6 -dev" ,
77 "authors" : [
88 {
99 "name" : " memory"
1818 "php-java/java-io-package" : " *" ,
1919 "php-java/java-net-package" : " *" ,
2020 "php-java/java-nio-package" : " *" ,
21- "gabrielelana/byte-units" : " dev-master"
21+ "gabrielelana/byte-units" : " dev-master" ,
22+ "symfony/console" : " ^4.3@dev"
2223 },
2324 "autoload" : {
2425 "psr-4" : {
25- "PHPJava\\ " : " src/"
26+ "PHPJava\\ " : " src/" ,
27+ "PHPJava\\ Console\\ " : " bin/"
2628 }
2729 },
2830 "autoload-dev" : {
Original file line number Diff line number Diff line change @@ -12,5 +12,5 @@ final class PHPJava
1212 /**
1313 * As same as composer version.
1414 */
15- const VERSION = 0x000065 ;
15+ const VERSION = 0x000066 ;
1616}
You can’t perform that action at this time.
0 commit comments