4 if (php_sapi_name() !== 'cli') {
8 require __DIR__ . '/vendor/autoload.php';
10 use Symfony\Component\Console\Application;
11 use Cli\Commands\BackupCommand;
12 use Cli\Commands\InitCommand;
13 use Cli\Commands\UpdateCommand;
14 use Symfony\Component\Console\Formatter\OutputFormatterStyle;
15 use Symfony\Component\Console\Output\ConsoleOutput;
18 $app = new Application('bookstack-system');
19 $app->setCatchExceptions(false);
21 $app->add(new BackupCommand());
22 $app->add(new UpdateCommand());
23 $app->add(new InitCommand());
27 } catch (Exception $error) {
28 $output = (new ConsoleOutput())->getErrorOutput();
29 $output->getFormatter()->setStyle('error', new OutputFormatterStyle('red'));
30 $output->writeln("<error>\nAn error occurred when attempting to run a command:\n</error>");
31 $output->writeln($error->getMessage());