From f5f2982d1261f8492eefa6946459279100fe65bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Tue, 8 Sep 2020 10:58:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Console/AbstractConsole.php | 1 - Console/ConsoleProviders.php | 4 +++- System/Application.php | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Console/AbstractConsole.php b/Console/AbstractConsole.php index b0a33e0c..defa01bc 100644 --- a/Console/AbstractConsole.php +++ b/Console/AbstractConsole.php @@ -21,7 +21,6 @@ abstract class AbstractConsole extends Component * @var Command[] */ public $commands = [ - DefaultCommand::class ]; /** @var Input $parameters */ diff --git a/Console/ConsoleProviders.php b/Console/ConsoleProviders.php index 9bf851fb..4dc5f374 100644 --- a/Console/ConsoleProviders.php +++ b/Console/ConsoleProviders.php @@ -20,7 +20,9 @@ class ConsoleProviders extends Providers */ public function onImport(Application $application) { - $application->set('console', ['class' => Console::class]); + /** @var Console $console */ + $console = $application->set('console', ['class' => Console::class]); + $console->register(DefaultCommand::class); } diff --git a/System/Application.php b/System/Application.php index f14ec483..5d9f40bb 100644 --- a/System/Application.php +++ b/System/Application.php @@ -91,10 +91,10 @@ class Application extends BaseApplication $this->set('input', $argv); try { $manager = Snowflake::app()->get('console'); - $manager->setParameters(); + $manager->setParameters($argv); $class = $manager->search(); $params = response()->send($manager->execCommand($class)); - } catch (\Exception $exception) { + } catch (\Throwable $exception) { $params = response()->send(implode("\n", [ 'Msg: ' . $exception->getMessage(), 'Line: ' . $exception->getLine(),