#!/usr/bin/env php command('install', function ($output) { should_be_sudo(); Malt\LaunchDaemon::install(); Malt\Configuration::install(); Malt\DnsMasq::install($output); $output->writeln(PHP_EOL.'Malt installed successfully!'); }); /** * Add the current working directory to the paths configuration. */ $app->command('serve', function ($output) { should_be_sudo(); Malt\Configuration::addPath(getcwd()); Malt\LaunchDaemon::restart(); $output->writeln('This directory has been added to your serve paths!'); }); /** * Add the current working directory to the paths configuration. */ $app->command('logs', function ($output) { $paths = Malt\Configuration::read()['paths']; $files = []; foreach ($paths as $path) { foreach (scandir($path) as $directory) { if (! in_array($directory, ['.', '..']) && file_exists($logPath = $path.'/'.$directory.'/storage/logs/laravel.log')) { $files[] = $logPath; } } } if (count($files) > 0) { passthru('tail -f '.implode(' ', $files)); } else { $output->writeln('No log files were found.'); } }); /** * Add the current working directory to the paths configuration. */ $app->command('restart', function ($output) { should_be_sudo(); Malt\LaunchDaemon::restart(); $output->writeln('Malt services have been restarted.'); }); /** * Add the current working directory to the paths configuration. */ $app->command('stop', function ($output) { should_be_sudo(); Malt\LaunchDaemon::stop(); $output->writeln('Malt services have been stopped.'); }); /** * Add the current working directory to the paths configuration. */ $app->command('uninstall', function ($output) { should_be_sudo(); Malt\LaunchDaemon::uninstall(); $output->writeln('Malt has been uninstalled.'); }); /** * Run the application. */ $app->run();