From 0f5c48460c94e2267573c3b12af23fdbe5a1ee79 Mon Sep 17 00:00:00 2001 From: Owen Voke Date: Fri, 16 Aug 2024 16:04:02 +0100 Subject: [PATCH] feat: add support for quiet output --- src/DatabaseDumpCommand.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/DatabaseDumpCommand.php b/src/DatabaseDumpCommand.php index 1bd8a35..16643be 100644 --- a/src/DatabaseDumpCommand.php +++ b/src/DatabaseDumpCommand.php @@ -6,6 +6,8 @@ use Illuminate\Console\Command; use Illuminate\Support\Facades\DB; +use Symfony\Component\Console\Output\ConsoleOutput; +use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\StreamOutput; use Worksome\Foggy\DumpProcess; @@ -29,7 +31,11 @@ public function handle(): void ? new StreamOutput(fopen($this->option('output'), 'w')) : $this->getOutput()->getOutput(); - $consoleOutput = $this->option('output') ? $this->getOutput()->getOutput() : null; + $consoleOutput = match (true) { + $this->option('output') && $this->option('quiet') => new ConsoleOutput(OutputInterface::VERBOSITY_QUIET), + $this->option('output') => $this->getOutput()->getOutput(), + default => null, + }; $process = new DumpProcess( DB::connection($this->option('connection'))->getDoctrineConnection(),