Skip to content

Commit bcfea21

Browse files
committed
adding support for --quiet
1 parent 510be37 commit bcfea21

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/PatternLab/Console/Commands/ServerCommand.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ public function __construct() {
2626
Console::setCommand($this->command,"Start the PHP-based server","The server command will start PHP's web server for you.","s");
2727
Console::setCommandOption($this->command,"host:","Provide a custom hostname. Default value is <path>localhost</path>.","To use a custom hostname and the default port:","","<host>");
2828
Console::setCommandOption($this->command,"port:","Provide a custom port. Default value is <path>8080</path>.","To use a custom port and the default hostname:","","<port>");
29+
Console::setCommandOption($this->command,"quiet","Turn on quiet mode for the server.","To turn on quiet mode:");
2930
Console::setCommandSample($this->command,"To provide both a custom hostname and port:","--host <host> --port <port>");
30-
31+
3132
}
3233

3334
public function run() {
@@ -48,9 +49,13 @@ public function run() {
4849
$port = Console::findCommandOptionValue("port");
4950
$host = $port ? $host.":".$port : $host.":8080";
5051

52+
$null = Console::findCommandOption("quiet");
53+
$null = $null ? " >& /dev/null" : "";
54+
5155
// start-up the server with the router
5256
Console::writeInfo("server started on http://".$host." - use ctrl+c to exit...");
53-
passthru("cd ".$publicDir." && ".$_SERVER["_"]." -S ".$host." ".$coreDir."/server/router.php");
57+
58+
passthru("cd ".$publicDir." && ".$_SERVER["_"]." -S ".$host." ".$coreDir."/server/router.php".$null);
5459

5560
}
5661

0 commit comments

Comments
 (0)