Skip to content

Commit 09cffa7

Browse files
committed
🔨 modify and improve Help console command
Signed-off-by: otengkwame <[email protected]>
1 parent db928d1 commit 09cffa7

File tree

1 file changed

+48
-11
lines changed

1 file changed

+48
-11
lines changed

Core/core/Console/Commands/Help.php

Lines changed: 48 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,20 @@ public static function showHelp(): void
3939

4040
$output .= " \n";
4141
$output .= ConsoleColor::yellow(" Available Commands:") . " \n";
42-
$output .= ConsoleColor::light_purple(" serve") . ConsoleColor::cyan(" Serve your application with Webby Server") . " \n";
43-
$output .= ConsoleColor::light_purple(" run:migration") . ConsoleColor::cyan(" Run and manage migrations for databases") . " \n";
44-
$output .= ConsoleColor::light_purple(" list:routes") . ConsoleColor::cyan(" List all available routes") . " \n";
45-
$output .= ConsoleColor::light_purple(" app:off") . ConsoleColor::cyan(" Turn maintenance mode on") . " \n";
46-
$output .= ConsoleColor::light_purple(" app:on") . ConsoleColor::cyan(" Turn maintenance mode off") . " \n";
47-
$output .= ConsoleColor::light_purple(" resource:link") . ConsoleColor::cyan(" Create a symlink for the resources folder in public") . " \n";
48-
$output .= ConsoleColor::light_purple(" use:command") . ConsoleColor::cyan(" This enables you to access console controllers to perform cli tasks") . " \n";
49-
$output .= ConsoleColor::light_purple(" git:init") . ConsoleColor::cyan(" Initialize your project to use git") . " \n";
50-
$output .= ConsoleColor::light_purple(" update:engine") . ConsoleColor::cyan(" Update sylynder engine") . " \n";
51-
$output .= ConsoleColor::light_purple(" clear:cache") . ConsoleColor::cyan(" Clear specific cached files") . " \n";
42+
$output .= ConsoleColor::light_purple(" serve") . ConsoleColor::cyan(" Serve your application with Webby Server") . " \n";
43+
$output .= ConsoleColor::light_purple(" quit") . ConsoleColor::cyan(" Quit Webby server or specify a given port to quit server on") . " \n";
44+
$output .= ConsoleColor::light_purple(" run:migration") . ConsoleColor::cyan(" Run and manage migrations for databases") . " \n";
45+
$output .= ConsoleColor::light_purple(" list:routes") . ConsoleColor::cyan(" List all available routes") . " \n";
46+
$output .= ConsoleColor::light_purple(" app:off") . ConsoleColor::cyan(" Turn maintenance mode on") . " \n";
47+
$output .= ConsoleColor::light_purple(" app:on") . ConsoleColor::cyan(" Turn maintenance mode off") . " \n";
48+
$output .= ConsoleColor::light_purple(" app:to-production") . ConsoleColor::cyan(" Make application ready for production mode") . " \n";
49+
$output .= ConsoleColor::light_purple(" app:to-testing") . ConsoleColor::cyan(" Make application ready for testing mode") . " \n";
50+
$output .= ConsoleColor::light_purple(" app:to-development") . ConsoleColor::cyan(" Make application ready for development mode") . " \n";
51+
$output .= ConsoleColor::light_purple(" resource:link") . ConsoleColor::cyan(" Create a symlink for the resources folder in public") . " \n";
52+
$output .= ConsoleColor::light_purple(" use:command") . ConsoleColor::cyan(" This enables you to access console controllers to perform cli tasks") . " \n";
53+
$output .= ConsoleColor::light_purple(" git:init") . ConsoleColor::cyan(" Initialize your project to use git") . " \n";
54+
$output .= ConsoleColor::light_purple(" update:engine") . ConsoleColor::cyan(" Update sylynder engine") . " \n";
55+
$output .= ConsoleColor::light_purple(" clear:cache") . ConsoleColor::cyan(" Clear specific cached files") . " \n";
5256

5357
$output .= " \n";
5458
$output .= ConsoleColor::yellow(" Generator Commands:") . " \n";
@@ -82,14 +86,43 @@ private static function serve()
8286
{$welcome}
8387
{$description}
8488
The webby server for local development.
89+
It uses the PHP built-in web server.
8590
8691
{$usage}
8792
php webby serve [option]
8893
8994
{$examples}
9095
php webby serve
9196
php webby serve --port 8086
92-
php webby serve --port 9000
97+
php webby serve --host localhost --port 8086
98+
php webby serve --host webby.local --port 8086
99+
100+
SERVE;
101+
}
102+
103+
private static function quit()
104+
{
105+
$welcome = static::welcome();
106+
$usage = static::hereColor('Usage:', 'yellow');
107+
$description = static::hereColor('Description:', 'yellow');
108+
$examples = static::hereColor('Examples:', 'yellow');
109+
110+
echo <<<SERVE
111+
{$welcome}
112+
{$description}
113+
Quit a webby server.
114+
You can specify port number and seconds to quit server.
115+
116+
{$usage}
117+
php webby quit [option]
118+
119+
{$examples}
120+
php webby quit
121+
php webby quit in 5
122+
php webby quit --in 5
123+
php webby quit --port 8009
124+
php webby quit --port 8009 in 5
125+
php webby quit --port 8009 --in 5
93126
94127
SERVE;
95128
}
@@ -178,6 +211,7 @@ private static function listRoutes()
178211
{$welcome}
179212
{$description}
180213
List all routes defined in your entire application.
214+
Except automatic routes.
181215
182216
{$usage}
183217
php webby list:routes
@@ -768,6 +802,9 @@ public static function whichHelp($command)
768802
case 'serve':
769803
Help::serve();
770804
break;
805+
case 'quit':
806+
Help::quit();
807+
break;
771808
case 'key:generate':
772809
Help::keyGenerate();
773810
break;

0 commit comments

Comments
 (0)