File tree Expand file tree Collapse file tree 6 files changed +20
-16
lines changed
Expand file tree Collapse file tree 6 files changed +20
-16
lines changed Original file line number Diff line number Diff line change @@ -21,13 +21,13 @@ $app = sprout()->createApp([
2121]);
2222
2323// $app->register(Leaf\Console\CreateCommand::class);
24+ // $app->register(Leaf\Console\UICommand::class);
2425$ app ->register (Leaf \Console \UpdateCommand::class);
2526$ app ->register (Leaf \Console \InstallCommand::class);
2627$ app ->register (Leaf \Console \UninstallCommand::class);
2728$ app ->register (Leaf \Console \ServeCommand::class);
2829$ app ->register (Leaf \Console \InteractCommand::class);
2930$ app ->register (Leaf \Console \RunCommand::class);
30- $ app ->register (Leaf \Console \UICommand::class);
3131$ app ->register (Leaf \Console \ViewBuildCommand::class);
3232// $app->register(Leaf\Console\ViewInstallCommand::class);
3333
Original file line number Diff line number Diff line change 88
99class InstallCommand extends Command
1010{
11- protected $ signature = 'install {packages*} {--d|dev} ' ;
11+ protected $ signature = 'install {packages? *} {--d|dev=false : Install as a dev dependency } ' ;
1212
1313 protected $ description = 'Install a new package ' ;
1414
15- protected function execute (): int
15+ protected function handle (): int
1616 {
1717 $ packages = $ this ->argument ('packages ' );
18+ $ parsedPackages = [];
1819
1920 if (count ($ packages )) {
2021 foreach ($ packages as $ package ) {
@@ -25,14 +26,14 @@ protected function execute(): int
2526 $ package = str_replace ('@ ' , ': ' , $ package );
2627 $ package = $ this ->option ('dev ' ) ? "$ package --dev " : $ package ;
2728
28- $ this ->writeln ("<info>Installing $ package...</info> " );
29-
30- if (!sprout ()->composer ()->install ($ package )->isSuccessful ()) {
31- return 1 ;
32- }
29+ $ parsedPackages [] = $ package ;
30+ }
3331
34- $ this ->writeln ("<comment> $ package installed successfully!</comment> " );
32+ if (!sprout ()->composer ()->install (implode (' ' , $ parsedPackages ) . ' --ansi ' )->isSuccessful ()) {
33+ return 1 ;
3534 }
35+
36+ return 0 ;
3637 }
3738
3839 return (int ) sprout ()->composer ()->install ()->isSuccessful ();
Original file line number Diff line number Diff line change 88
99class RunCommand extends Command
1010{
11- protected $ signature = 'run {script! : Command to run.} ' ;
11+ protected $ signature = 'run {script : Command to run.} ' ;
1212
1313 protected $ description = 'Run a script in your composer.json ' ;
1414
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ class ServeCommand extends Command
1818 protected function handle (): int
1919 {
2020 if ($ this ->isMVCApp ()) {
21- return (int ) sprout ()->run ("php leaf serve --ansi " );
21+ return (int ) sprout ()->run ("php leaf serve --port= { $ this -> option ( ' port ' )} -- ansi " , null );
2222 }
2323
2424 if (!sprout ()->composer ()->json ()) {
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ class UICommand extends Command
1212
1313 protected $ description = 'Open up the Leaf CLI GUI ' ;
1414
15- protected function execute (): int
15+ protected function handle (): int
1616 {
1717 $ port = $ this ->option ('port ' );
1818
Original file line number Diff line number Diff line change @@ -12,9 +12,10 @@ class UninstallCommand extends Command
1212
1313 protected $ description = 'Uninstall a package ' ;
1414
15- protected function execute (): int
15+ protected function handle (): int
1616 {
1717 $ packages = $ this ->argument ('packages ' );
18+ $ parsedPackages = [];
1819
1920 if (!sprout ()->composer ()->json ()) {
2021 $ this ->writeln ('<error>No composer.json found in the current directory.</error> ' );
@@ -26,9 +27,11 @@ protected function execute(): int
2627 $ package = "leafs/ $ package " ;
2728 }
2829
29- if (!sprout ()->composer ()->remove ($ package )->isSuccessful ()) {
30- return 1 ;
31- }
30+ $ parsedPackages [] = $ package ;
31+ }
32+
33+ if (!sprout ()->composer ()->remove (implode (' ' , $ parsedPackages ) . ' --ansi ' )->isSuccessful ()) {
34+ return 1 ;
3235 }
3336
3437 $ this ->writeln ('<comment>packages uninstalled successfully!</comment> ' );
You can’t perform that action at this time.
0 commit comments