diff --git a/app/Console/MigrateInstallCommand.php b/app/Console/MigrateInstallCommand.php deleted file mode 100644 index ffeed3e0c1..0000000000 --- a/app/Console/MigrateInstallCommand.php +++ /dev/null @@ -1,32 +0,0 @@ -. - * - * @link http://librenms.org - * @copyright 2019 Tony Murray - * @author Tony Murray - */ - -namespace App\Console; - -use Illuminate\Database\Console\Migrations\InstallCommand; - -class MigrateInstallCommand extends InstallCommand -{ - protected $hidden = true; -} diff --git a/app/Console/ModelMakeCommand.php b/app/Console/ModelMakeCommand.php deleted file mode 100644 index e13c26548e..0000000000 --- a/app/Console/ModelMakeCommand.php +++ /dev/null @@ -1,41 +0,0 @@ -. - * - * @link http://librenms.org - * @copyright 2019 Tony Murray - * @author Tony Murray - */ - -namespace App\Console; - -use Illuminate\Foundation\Console\ModelMakeCommand as LaravelModelMakeCommand; - -class ModelMakeCommand extends LaravelModelMakeCommand -{ - /** - * Get the default namespace for the class. - * - * @param string $rootNamespace - * @return string - */ - protected function getDefaultNamespace($rootNamespace) - { - return $rootNamespace . '\Models'; - } -} diff --git a/app/Providers/CliServiceProvider.php b/app/Providers/CliServiceProvider.php index bb8fdfc661..a0234a1a9a 100644 --- a/app/Providers/CliServiceProvider.php +++ b/app/Providers/CliServiceProvider.php @@ -2,40 +2,15 @@ namespace App\Providers; -use App\Console\MigrateInstallCommand; -use Illuminate\Foundation\Providers\ArtisanServiceProvider; +use Illuminate\Support\ServiceProvider; -class CliServiceProvider extends ArtisanServiceProvider +class CliServiceProvider extends ServiceProvider { public function register() { // Restrict LibreNMS CLI commands - if (defined('LIBRENMS_CLI') && $this->app->environment() == 'production') { - $this->commands = array_intersect_key($this->commands, [ - 'Migrate' => true, - 'MigrateInstall' => true, - ]); - - $this->registerCommands($this->commands); - } else { - $this->app->register(\Laravel\Tinker\TinkerServiceProvider::class); - parent::register(); + if (defined('ARTISAN_BINARY') && ARTISAN_BINARY == 'lnms' && $this->app->environment() == 'production') { + $this->app->register(\NunoMaduro\LaravelConsoleSummary\LaravelConsoleSummaryServiceProvider::class); } } - - protected function registerModelMakeCommand() - { - // override with our own implementation to put models in the correct namespace - $this->app->singleton('command.model.make', function ($app) { - return new \App\Console\ModelMakeCommand($app['files']); - }); - } - - protected function registerMigrateInstallCommand() - { - // override so we can hide it - $this->app->singleton('command.migrate.install', function ($app) { - return new MigrateInstallCommand($app['migration.repository']); - }); - } } diff --git a/composer.json b/composer.json index d9707f7472..78695c3272 100644 --- a/composer.json +++ b/composer.json @@ -46,6 +46,7 @@ "laravel/tinker": "^2.0", "laravel/ui": "^3.0", "librenms/laravel-vue-i18n-generator": "^0.1.46", + "nunomaduro/laravel-console-summary": "^1.7", "oriceon/toastr-5-laravel": "dev-master", "pear/console_color2": "^0.1", "pear/console_table": "^1.3", @@ -129,5 +130,12 @@ "python-requirements": [ "scripts/check_requirements.py || pip3 install --user -r requirements.txt || :" ] + }, + "extra": { + "laravel": { + "dont-discover": [ + "nunomaduro/laravel-console-summary" + ] + } } } diff --git a/composer.lock b/composer.lock index de7b6aa685..001e8a0991 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "05264c05dd948950fbe0657997dc873e", + "content-hash": "3e9cbf21097ccab201f6851522787f3e", "packages": [ { "name": "amenadiel/jpgraph", @@ -2367,6 +2367,65 @@ ], "time": "2020-09-26T10:30:38+00:00" }, + { + "name": "nunomaduro/laravel-console-summary", + "version": "v1.7.0", + "source": { + "type": "git", + "url": "https://github.com/nunomaduro/laravel-console-summary.git", + "reference": "f43a1aa3c655190fe12ae461e7dda2876ca26890" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nunomaduro/laravel-console-summary/zipball/f43a1aa3c655190fe12ae461e7dda2876ca26890", + "reference": "f43a1aa3c655190fe12ae461e7dda2876ca26890", + "shasum": "" + }, + "require": { + "illuminate/console": "^7.0|^8.0", + "illuminate/support": "^7.0|^8.0", + "php": "^7.2.5|^8.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "NunoMaduro\\LaravelConsoleSummary\\LaravelConsoleSummaryServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "NunoMaduro\\LaravelConsoleSummary\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nuno Maduro", + "email": "enunomaduro@gmail.com" + } + ], + "description": "A Beautiful Laravel Console Summary for your Laravel/Laravel Zero commands.", + "keywords": [ + "artisan", + "cli", + "command-line", + "console", + "laravel", + "laravel-zero", + "php", + "symfony" + ], + "support": { + "issues": "https://github.com/nunomaduro/laravel-console-summary/issues", + "source": "https://github.com/nunomaduro/laravel-console-summary" + }, + "time": "2020-10-30T14:42:45+00:00" + }, { "name": "opis/closure", "version": "3.6.0", diff --git a/config/laravel-console-summary.php b/config/laravel-console-summary.php new file mode 100644 index 0000000000..419457bd8e --- /dev/null +++ b/config/laravel-console-summary.php @@ -0,0 +1,58 @@ + [ + 'auth:*', + 'cache:*', + 'clear-compiled', + 'config:cache', + 'config:clear', + 'db:*', + 'debugbar:*', + 'down', + 'dusk', + 'dusk:*', + 'env', + 'event:*', + 'help', + 'ide-helper:*', + 'key:*', + 'list', + 'make:*', + 'migrate:*', + 'notifications:*', + 'optimize:*', + 'package:*', + 'queue:*', + 'release:*', + 'route:*', + 'schedule:*', + 'schema:*', + 'serve', + 'session:*', + 'storage:*', + 'stub:*', + 'test', + 'tinker', + 'translation:*', + 'ui:*', + 'up', + 'vendor:*', + 'view:*', + 'vue-i18n:*', + 'ziggy:*', + ], +]; diff --git a/lnms b/lnms index 67edb0ee3c..60cf30a9e5 100755 --- a/lnms +++ b/lnms @@ -31,7 +31,7 @@ $app = require_once __DIR__.'/bootstrap/app.php'; | */ -define('LIBRENMS_CLI', true); +define('ARTISAN_BINARY', 'lnms'); $kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);