From 20dc53590418db245ebce0e65a9a388b14648942 Mon Sep 17 00:00:00 2001 From: 377960738 <377960738@163.com> Date: Thu, 18 Aug 2022 14:34:50 +0800 Subject: [PATCH 1/4] load command from confiog.command --- src/webman | 1 + 1 file changed, 1 insertion(+) diff --git a/src/webman b/src/webman index 920f439..d4e8cba 100755 --- a/src/webman +++ b/src/webman @@ -23,6 +23,7 @@ $cli->installInternalCommands(); if (is_dir($command_path = Util::guessPath(app_path(), '/command', true))) { $cli->installCommands($command_path); } +$cli->installUserCommands(); foreach (config('plugin', []) as $firm => $projects) { if (isset($projects['app'])) { From 7930cd4eb9ce9ec3614f139bfe8f9f0267949391 Mon Sep 17 00:00:00 2001 From: 377960738 <377960738@163.com> Date: Thu, 18 Aug 2022 14:39:54 +0800 Subject: [PATCH 2/4] Update Command.php --- src/Command.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Command.php b/src/Command.php index d81e210..0da0df2 100644 --- a/src/Command.php +++ b/src/Command.php @@ -33,4 +33,18 @@ public function installCommands($path, $namspace = 'app\command') $this->add(new $class_name); } } + + public function installUserCommands() + { + //get command from config + $commands = config('command', []); + + foreach ($commands as $command) { + // check command class whether instanceof SymfonyCommand + if (!is_a($command, Commands::class, true)) { + continue; + } + $this->add(new $command); + } + } } From 69a5c80d877ded0ccf3f002a151bae090ecefef4 Mon Sep 17 00:00:00 2001 From: 377960738 <377960738@163.com> Date: Thu, 18 Aug 2022 15:03:57 +0800 Subject: [PATCH 3/4] Update Install.php --- src/Install.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Install.php b/src/Install.php index 7621d7f..b442ea5 100644 --- a/src/Install.php +++ b/src/Install.php @@ -20,6 +20,9 @@ public static function install() { copy(__DIR__ . "/webman", base_path()."/webman"); chmod(base_path()."/webman", 0755); + + copy(__DIR__ . '/command.php', config_path() . '/command.php'); + chmod(config_path() . '/command.php', 0644); static::installByRelation(); } From b72c0d2ff2cff0ec5b975298873e92093b0574f3 Mon Sep 17 00:00:00 2001 From: 377960738 <377960738@163.com> Date: Thu, 18 Aug 2022 15:04:51 +0800 Subject: [PATCH 4/4] Create command.php --- src/command.php | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 src/command.php diff --git a/src/command.php b/src/command.php new file mode 100644 index 0000000..ca5d8ed --- /dev/null +++ b/src/command.php @@ -0,0 +1,5 @@ +