File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ public static function main(array $args = [])
3232 $ rootCommand ->setHandler (function (object $ sender , CommandEventArgs $ args ): void {
3333 $ version = $ args ->get ('--version ' );
3434 if ($ version ) {
35- Console::writeLine ("DevNet CLI: 1.0.0 " );
35+ Console::writeLine ("DevNet CLI: " . static :: getVersion () );
3636 return ;
3737 }
3838
@@ -53,4 +53,16 @@ public static function main(array $args = [])
5353
5454 $ rootCommand ->invoke ($ args );
5555 }
56+
57+ public static function getVersion (): string
58+ {
59+ $ json = json_decode (file_get_contents (dirname (__DIR__ , 4 ). "/vendor/composer/installed.json " ));
60+ foreach ($ json ->packages as $ package ) {
61+ if ($ package ->name == "devnet/cli " ) {
62+ return $ package ->version ;
63+ }
64+ }
65+
66+ return "0.0.0 " ;
67+ }
5668}
You can’t perform that action at this time.
0 commit comments