Enable Discovery debug logging for production troubleshooting
- Add DISCOVERY_LOG_LEVEL=debug - Add DISCOVERY_SHOW_PROGRESS=true - Temporary changes for debugging InitializerProcessor fixes on production
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Framework\Console\DemoCommand;
|
||||
@@ -8,18 +9,24 @@ use App\Framework\Console\ConsoleInput;
|
||||
use App\Framework\Console\ConsoleOutput;
|
||||
use App\Framework\Console\ConsoleStyle;
|
||||
use App\Framework\Console\Screen\ScreenType;
|
||||
|
||||
use App\Framework\Core\ValueObjects\Duration;
|
||||
use App\Framework\DateTime\Timer;
|
||||
|
||||
final class ScreenDemoCommand
|
||||
{
|
||||
public function __construct(
|
||||
private readonly Timer $timer
|
||||
) {
|
||||
}
|
||||
|
||||
#[ConsoleCommand('demo:screen', 'Zeigt die verschiedenen Screen-Management-Funktionen')]
|
||||
public function __invoke(ConsoleInput $input, ConsoleOutput $output): int
|
||||
{
|
||||
// Aktiviere interaktiven Modus
|
||||
$output->screen()->setInteractiveMode(true);
|
||||
$output->screen->setInteractiveMode(true);
|
||||
|
||||
// Zeige ein Menü
|
||||
$output->screen()->newMenu();
|
||||
$output->screen->newMenu();
|
||||
$output->writeLine('=== Screen-Management Demo ===', ConsoleStyle::success());
|
||||
$output->writeLine('');
|
||||
$output->writeLine('1. Cursor-Bewegungen');
|
||||
@@ -33,15 +40,19 @@ final class ScreenDemoCommand
|
||||
switch ($choice) {
|
||||
case '1':
|
||||
$this->demoCursor($input, $output);
|
||||
|
||||
break;
|
||||
case '2':
|
||||
$this->demoDisplay($input, $output);
|
||||
|
||||
break;
|
||||
case '3':
|
||||
$this->demoProgress($input, $output);
|
||||
|
||||
break;
|
||||
case '4':
|
||||
$this->demoTypeset($input, $output);
|
||||
|
||||
break;
|
||||
default:
|
||||
$output->writeError('Ungültige Auswahl!');
|
||||
@@ -52,37 +63,37 @@ final class ScreenDemoCommand
|
||||
|
||||
private function demoCursor(ConsoleInput $input, ConsoleOutput $output): void
|
||||
{
|
||||
$output->screen()->newScreen(ScreenType::CONTENT);
|
||||
$output->screen->new(ScreenType::CONTENT);
|
||||
$output->writeLine('=== Cursor-Bewegungs-Demo ===', ConsoleStyle::success());
|
||||
$output->writeLine('');
|
||||
|
||||
// Cursor-Bewegungen
|
||||
$output->writeLine('Der Cursor wird jetzt bewegt...');
|
||||
sleep(1);
|
||||
$this->timer->sleep(Duration::fromSeconds(1));
|
||||
|
||||
$output->cursor()->down(2)->right(5);
|
||||
$output->cursor->down(2)->right(5);
|
||||
$output->write('Hallo!', ConsoleStyle::success());
|
||||
sleep(1);
|
||||
$this->timer->sleep(Duration::fromSeconds(1));
|
||||
|
||||
$output->cursor()->down(1)->left(5);
|
||||
$output->cursor->down(1)->left(5);
|
||||
$output->write('Welt!', ConsoleStyle::info());
|
||||
sleep(1);
|
||||
$this->timer->sleep(Duration::fromSeconds(1));
|
||||
|
||||
$output->cursor()->moveTo(10, 20);
|
||||
$output->cursor->moveTo(10, 20);
|
||||
$output->write('Position 10,20', ConsoleStyle::warning());
|
||||
sleep(1);
|
||||
$this->timer->sleep(Duration::fromSeconds(1));
|
||||
|
||||
$output->cursor()->home();
|
||||
$output->cursor->home();
|
||||
$output->writeLine("\nZurück zum Anfang!", ConsoleStyle::error());
|
||||
sleep(1);
|
||||
$this->timer->sleep(Duration::fromSeconds(1));
|
||||
|
||||
$output->writeLine("\nDrücken Sie eine Taste, um fortzufahren...");
|
||||
$output->screen()->waitForInput();
|
||||
$output->screen->waitForInput();
|
||||
}
|
||||
|
||||
private function demoDisplay(ConsoleInput $input, ConsoleOutput $output): void
|
||||
{
|
||||
$output->screen()->newScreen(ScreenType::CONTENT);
|
||||
$output->screen->new(ScreenType::CONTENT);
|
||||
$output->writeLine('=== Bildschirmlöschungs-Demo ===', ConsoleStyle::success());
|
||||
$output->writeLine('');
|
||||
|
||||
@@ -91,36 +102,36 @@ final class ScreenDemoCommand
|
||||
$output->writeLine("Zeile $i: Dies ist ein Test");
|
||||
}
|
||||
|
||||
sleep(1);
|
||||
$this->timer->sleep(Duration::fromSeconds(1));
|
||||
$output->writeLine("\nLösche in 3 Sekunden den Bildschirm...");
|
||||
sleep(3);
|
||||
$this->timer->sleep(Duration::fromSeconds(3));
|
||||
|
||||
// Bildschirm löschen
|
||||
$output->display()->clear();
|
||||
$output->display->clear();
|
||||
$output->writeLine('Bildschirm wurde gelöscht!');
|
||||
sleep(1);
|
||||
$this->timer->sleep(Duration::fromSeconds(1));
|
||||
|
||||
// Zeilen hinzufügen
|
||||
for ($i = 1; $i <= 5; $i++) {
|
||||
$output->writeLine("Neue Zeile $i");
|
||||
}
|
||||
|
||||
sleep(1);
|
||||
$this->timer->sleep(Duration::fromSeconds(1));
|
||||
$output->writeLine("\nLösche nur die aktuelle Zeile in 2 Sekunden...");
|
||||
sleep(2);
|
||||
$this->timer->sleep(Duration::fromSeconds(2));
|
||||
|
||||
// Zeile löschen
|
||||
$output->display()->clearLine();
|
||||
$output->display->clearLine();
|
||||
$output->writeLine('Die Zeile wurde gelöscht und durch diese ersetzt!');
|
||||
|
||||
sleep(1);
|
||||
$this->timer->sleep(Duration::fromSeconds(1));
|
||||
$output->writeLine("\nDrücken Sie eine Taste, um fortzufahren...");
|
||||
$output->screen()->waitForInput();
|
||||
$output->screen->waitForInput();
|
||||
}
|
||||
|
||||
private function demoProgress(ConsoleInput $input, ConsoleOutput $output): void
|
||||
{
|
||||
$output->screen()->newScreen(ScreenType::PROGRESS);
|
||||
$output->screen->new(ScreenType::PROGRESS);
|
||||
$output->writeLine('=== Fortschrittsanzeige-Demo ===', ConsoleStyle::success());
|
||||
$output->writeLine('');
|
||||
|
||||
@@ -131,22 +142,22 @@ final class ScreenDemoCommand
|
||||
$bar = str_repeat('█', $i) . str_repeat('░', $total - $i);
|
||||
|
||||
// Zeile löschen und neue Fortschrittsanzeige
|
||||
$output->display()->clearLine();
|
||||
$output->display->clearLine();
|
||||
$output->write("Fortschritt: [{$bar}] {$percent}%");
|
||||
|
||||
usleep(200000); // 200ms pause
|
||||
$this->timer->sleep(Duration::fromMilliseconds(200));
|
||||
}
|
||||
|
||||
$output->writeLine("\n\nFortschritt abgeschlossen!");
|
||||
sleep(1);
|
||||
$this->timer->sleep(Duration::fromSeconds(1));
|
||||
|
||||
$output->writeLine("\nDrücken Sie eine Taste, um fortzufahren...");
|
||||
$output->screen()->waitForInput();
|
||||
$output->screen->waitForInput();
|
||||
}
|
||||
|
||||
private function demoTypeset(ConsoleInput $input, ConsoleOutput $output): void
|
||||
{
|
||||
$output->screen()->newScreen(ScreenType::CONTENT);
|
||||
$output->screen->new(ScreenType::CONTENT);
|
||||
$output->writeLine('=== Typensatz-Demo ===', ConsoleStyle::success());
|
||||
$output->writeLine('');
|
||||
|
||||
@@ -157,17 +168,17 @@ final class ScreenDemoCommand
|
||||
// Typensatz-Effekt
|
||||
foreach (str_split($text) as $char) {
|
||||
$output->write($char);
|
||||
usleep(rand(50000, 150000)); // 50-150ms zufällige Pause
|
||||
$this->timer->sleep(Duration::fromMicroseconds(rand(50000, 150000)));
|
||||
}
|
||||
|
||||
$output->writeLine("\n\nTypensatz abgeschlossen!");
|
||||
sleep(1);
|
||||
$this->timer->sleep(Duration::fromSeconds(1));
|
||||
|
||||
$output->writeLine("\nDrücken Sie eine Taste, um zurückzukehren...");
|
||||
$output->screen()->waitForInput();
|
||||
$output->screen->waitForInput();
|
||||
|
||||
// Zurück zum Hauptmenü
|
||||
$output->screen()->newMenu();
|
||||
$output->screen->newMenu();
|
||||
$this->__invoke($input, $output);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user