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); + } + } } 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(); } 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 @@ +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'])) {