From c3aba72392c4e208b89614493485b7d24e84d9ea Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Sat, 11 Nov 2023 13:20:31 +0100 Subject: [PATCH 1/4] Remove explicit formatting from command signature options --- packages/framework/src/Console/Commands/ServeCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/framework/src/Console/Commands/ServeCommand.php b/packages/framework/src/Console/Commands/ServeCommand.php index 75240db7004..3f53e8b3ef4 100644 --- a/packages/framework/src/Console/Commands/ServeCommand.php +++ b/packages/framework/src/Console/Commands/ServeCommand.php @@ -22,7 +22,7 @@ class ServeCommand extends Command { /** @var string */ - protected $signature = 'serve {--host= : [default: "localhost"]}} {--port= : [default: 8080]}'; + protected $signature = 'serve {--host=localhost} {--port=8080}'; /** @var string */ protected $description = 'Start the realtime compiler server.'; From aea2b3bab661edee674b9f7b4e97c37af42d6ae0 Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Sat, 11 Nov 2023 13:29:59 +0100 Subject: [PATCH 2/4] Only write to dashboard console when using fancy output --- .../src/Http/DashboardController.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/realtime-compiler/src/Http/DashboardController.php b/packages/realtime-compiler/src/Http/DashboardController.php index 1e282a4f4f5..b129a16aedd 100644 --- a/packages/realtime-compiler/src/Http/DashboardController.php +++ b/packages/realtime-compiler/src/Http/DashboardController.php @@ -56,7 +56,10 @@ public function __construct() { $this->title = config('hyde.name').' - Dashboard'; $this->request = Request::capture(); - $this->console = new ConsoleOutput(); + + if (((bool) env('HYDE_RC_REQUEST_OUTPUT', false)) === true) { + $this->console = new ConsoleOutput(); + } $this->loadFlashData(); @@ -355,7 +358,7 @@ protected function createPage(): void $this->abort($exception->getCode(), $exception->getMessage()); } - $this->console->printMessage("Created file '$path'", 'dashboard@createPage'); + $this->writeToConsole("Created file '$path'", 'dashboard@createPage'); $this->flash('justCreatedPage', RouteKey::fromPage($pageClass, $pageClass::pathToIdentifier($path))->get()); $this->setJsonResponse(201, "Created file '$path'!"); @@ -510,4 +513,11 @@ protected function hasAsyncHeaders(): bool { return (getallheaders()['X-RC-Handler'] ?? getallheaders()['x-rc-handler'] ?? null) === 'Async'; } + + protected function writeToConsole(string $message, string $context = 'dashboard'): void + { + if (isset($this->console)) { + $this->console->printMessage($message, $context); + } + } } From f213efd7a804b78557294c00e4193c2e1165338d Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Sat, 11 Nov 2023 13:33:39 +0100 Subject: [PATCH 3/4] Revert "Remove explicit formatting from command signature options" This reverts commit c3aba72392c4e208b89614493485b7d24e84d9ea as this is needed to have the option values default to null while giving the documented value of the inferred values. --- packages/framework/src/Console/Commands/ServeCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/framework/src/Console/Commands/ServeCommand.php b/packages/framework/src/Console/Commands/ServeCommand.php index 3f53e8b3ef4..75240db7004 100644 --- a/packages/framework/src/Console/Commands/ServeCommand.php +++ b/packages/framework/src/Console/Commands/ServeCommand.php @@ -22,7 +22,7 @@ class ServeCommand extends Command { /** @var string */ - protected $signature = 'serve {--host=localhost} {--port=8080}'; + protected $signature = 'serve {--host= : [default: "localhost"]}} {--port= : [default: 8080]}'; /** @var string */ protected $description = 'Start the realtime compiler server.'; From afca62e0fc12fe3468258aa6241b7a3552679345 Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Sat, 11 Nov 2023 13:35:39 +0100 Subject: [PATCH 4/4] Wrap signature over multiple lines --- packages/framework/src/Console/Commands/ServeCommand.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/framework/src/Console/Commands/ServeCommand.php b/packages/framework/src/Console/Commands/ServeCommand.php index 75240db7004..bc738dacb7b 100644 --- a/packages/framework/src/Console/Commands/ServeCommand.php +++ b/packages/framework/src/Console/Commands/ServeCommand.php @@ -22,7 +22,10 @@ class ServeCommand extends Command { /** @var string */ - protected $signature = 'serve {--host= : [default: "localhost"]}} {--port= : [default: 8080]}'; + protected $signature = 'serve + {--host= : [default: "localhost"]}} + {--port= : [default: 8080]} + '; /** @var string */ protected $description = 'Start the realtime compiler server.';