#!/usr/bin/env php getFormatter(); $formatter->setStyle('warn', new OutputFormatterStyle('yellow')); $formatter->setStyle('info', new OutputFormatterStyle('blue')); $formatter->setStyle('success', new OutputFormatterStyle('green')); $formatter->setStyle('error', new OutputFormatterStyle('red')); // Run the command and handle errors try { $app->run(null, $output); } catch (Exception $error) { $output = (new ConsoleOutput())->getErrorOutput(); $output->getFormatter()->setStyle('error', new OutputFormatterStyle('red')); $output->writeln("\nAn error occurred when attempting to run a command:\n"); $output->writeln($error->getMessage()); exit(1); }