Skip to content

Commit ccba417

Browse files
authored
Merge pull request #10 from theokeist/codex/update-documentation-with-types-and-arguments-5y0vyq
Extend `serve` gate output: add DHD view, runtime/errors sections, and `--gate-filter` alias
2 parents 528b613 + c5621ca commit ccba417

2 files changed

Lines changed: 30 additions & 8 deletions

File tree

docs/CLI.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ php pipeflow serve [--host=<string>] [--port=<int>] [--gate[=<view>]] [--gate-se
7272
- `--host=<string>`: Host interface to bind (default: `127.0.0.1`).
7373
- `--port=<int>`: Port to bind (default: `8000`).
7474
- `--gate` (`bool`, optional): Enable the playful, colorful gate-style output.
75-
- `--gate=<view>` (`string`, optional): Select a gate view (`full` or `summary`).
76-
- `--gate-sections=<list>` (`string`, optional): Comma-separated sections to show (`portal,paths,tips`).
75+
- `--gate=<view>` (`string`, optional): Select a gate view (`full`, `summary`, or `dhd`).
76+
- `--gate-sections=<list>` (`string`, optional): Comma-separated sections to show (`portal,paths,runtime,errors,tips`).
7777
- `--gate-filter=<list>` (`string`, optional): Alias for `--gate-sections` to filter displayed sections.
7878
7979
**Related classes:**

src/Console/Commands/ServeCommand.php

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public function handle(array $args, Application $app): int
1818
$port = '8000';
1919
$gate = false;
2020
$gateView = 'full';
21-
$gateSections = ['portal', 'paths', 'tips'];
21+
$gateSections = ['portal', 'paths', 'runtime', 'tips'];
2222

2323
foreach ($args as $a) {
2424
if (str_starts_with($a, '--host=')) $host = substr($a, 7);
@@ -56,13 +56,22 @@ public function handle(array $args, Application $app): int
5656

5757
private function renderGate(string $host, string $port, string $docroot, string $view, array $sections): void
5858
{
59+
$startedAt = date('Y-m-d H:i:s');
5960
echo "\033[2J\033[H";
60-
echo $this->colorize("╔════════════════════════════════╗\n", 'cyan');
61-
echo $this->colorize("║ PIPEFLOW STARGATE CONSOLE ║\n", 'bold_cyan');
62-
echo $this->colorize("╚════════════════════════════════╝\n\n", 'cyan');
61+
if ($view === 'dhd') {
62+
echo $this->colorize("╔════════════════════════════════╗\n", 'cyan');
63+
echo $this->colorize("║ PIPEFLOW D.H.D. PANEL ║\n", 'bold_cyan');
64+
echo $this->colorize("╚════════════════════════════════╝\n", 'cyan');
65+
echo $this->colorize(" [1] [2] [3] [4] [5] [6]\n", 'blue');
66+
echo $this->colorize(" [7] [8] [9] [0] [⋆] [#]\n\n", 'blue');
67+
} else {
68+
echo $this->colorize("╔════════════════════════════════╗\n", 'cyan');
69+
echo $this->colorize("║ PIPEFLOW STARGATE CONSOLE ║\n", 'bold_cyan');
70+
echo $this->colorize("╚════════════════════════════════╝\n\n", 'cyan');
71+
}
6372

6473
if ($view === 'summary') {
65-
$sections = array_values(array_intersect($sections, ['portal', 'paths']));
74+
$sections = array_values(array_intersect($sections, ['portal', 'paths', 'runtime']));
6675
}
6776

6877
if (in_array('portal', $sections, true)) {
@@ -77,11 +86,24 @@ private function renderGate(string $host, string $port, string $docroot, string
7786
echo $this->colorize(" ▸ Docroot {$docroot}\n\n", 'cyan');
7887
}
7988

89+
if (in_array('runtime', $sections, true)) {
90+
echo $this->title('RUNTIME');
91+
echo $this->colorize(" ▸ Started {$startedAt}\n", 'cyan');
92+
echo $this->colorize(" ▸ PHP " . PHP_VERSION . "\n", 'cyan');
93+
echo $this->colorize(" ▸ PID " . getmypid() . "\n\n", 'cyan');
94+
}
95+
96+
if (in_array('errors', $sections, true)) {
97+
echo $this->title('ERRORS');
98+
echo $this->colorize(" ▸ No errors captured (dev server)\n\n", 'green');
99+
}
100+
80101
if (in_array('tips', $sections, true)) {
81102
echo $this->title('COMMANDS');
82103
echo $this->colorize(" ▸ php pipeflow route:list\n", 'blue');
83104
echo $this->colorize(" ▸ php pipeflow serve --gate=summary\n", 'blue');
84-
echo $this->colorize(" ▸ php pipeflow serve --gate-sections=portal,paths\n\n", 'blue');
105+
echo $this->colorize(" ▸ php pipeflow serve --gate-sections=portal,paths,runtime\n", 'blue');
106+
echo $this->colorize(" ▸ php pipeflow serve --gate=dhd --gate-filter=portal,errors\n\n", 'blue');
85107
}
86108
}
87109

0 commit comments

Comments
 (0)