From a5dc3800f985e4ab4c9efb6683da75e529971d62 Mon Sep 17 00:00:00 2001 From: Inhere Date: Fri, 24 Sep 2021 13:47:55 +0800 Subject: [PATCH] refactor: refactor the plugin run logic and update some command logic --- app/Console/CliApplication.php | 5 ++ app/Console/Command/RunCommand.php | 31 ++++++-- app/Console/Component/RedirectToGitGroup.php | 30 +++++--- app/Console/Controller/GitController.php | 56 ++++++++++---- app/Console/Controller/GitHubController.php | 47 ++++-------- app/Console/Controller/GitLabController.php | 28 ++----- app/Console/Controller/JsonController.php | 73 +++++++++++++++++-- app/Console/Controller/PluginController.php | 2 +- app/Console/Controller/UtilController.php | 11 ++- .../Listener/BeforeCommandRunListener.php | 16 ++-- app/Console/Listener/NotFoundListener.php | 27 ++++--- app/Console/Plugin/AbstractPlugin.php | 49 +++++++++++-- app/Console/Plugin/PluginManager.php | 15 ++-- config/config.php | 3 + 14 files changed, 262 insertions(+), 131 deletions(-) diff --git a/app/Console/CliApplication.php b/app/Console/CliApplication.php index 363461b..829b326 100644 --- a/app/Console/CliApplication.php +++ b/app/Console/CliApplication.php @@ -100,6 +100,11 @@ protected function registerServices(ObjectBox $box): void $jumpConf = $this->getArrayParam('jumper'); return QuickJump::new($jumpConf); }); + + // $box->set('envLoader', function () { + // $jumpConf = $this->getArrayParam('osEnv'); + // return QuickJump::new($jumpConf); + // }); } protected function initAppRun(): void diff --git a/app/Console/Command/RunCommand.php b/app/Console/Command/RunCommand.php index 80e1f49..45dffb0 100644 --- a/app/Console/Command/RunCommand.php +++ b/app/Console/Command/RunCommand.php @@ -12,10 +12,13 @@ use Inhere\Console\Command; use Inhere\Console\IO\Input; use Inhere\Console\IO\Output; +use Inhere\Console\Util\Show; use Inhere\Kite\Component\ScriptRunner; use Inhere\Kite\Kite; +use Toolkit\Stdlib\OS; use function count; use function is_array; +use function vdump; /** * Class RunCommand @@ -51,7 +54,7 @@ protected function beforeExecute(): bool * -l, --list List information for all scripts or script files. type: file, cmd(default) * -s, --search Display all matched scripts by the input name * --info Show information for give script name or file - * --dry-run bool;Mock running an script + * --dry-run bool;Mock running, not real execute. * --proxy bool;Enable proxy ENV setting * * @arguments @@ -65,7 +68,7 @@ protected function beforeExecute(): bool */ protected function execute(Input $input, Output $output) { - $name = $this->flags->getFirstArg(); + $name = $this->flags->getArg('name'); $listType = $this->flags->getOpt('list'); if ($listType === ScriptRunner::TYPE_FILE) { @@ -87,18 +90,30 @@ protected function execute(Input $input, Output $output) } if (!$name) { - $output->liteError('please input an script name for run or use -l TYPE see all scripts'); + $output->liteError('please input an name for run or use -l TYPE see all scripts'); return; } - $runArgs = $input->getArguments(); - unset($runArgs[0]); // first is script name - $dryRun = $this->flags->getOpt('dry-run'); $this->sr->setDryRun($dryRun); - // not found script name + // proxy + $openProxy = $this->flags->getOpt('proxy'); + $proxyEnv = $this->app->getArrayParam('proxyEnv'); + if ($openProxy && $proxyEnv) { + Show::aList($proxyEnv, 'Set Proxy ENV From Config: "proxyEnv"', [ + 'ucFirst' => false, + 'ucTitleWords' => false, + ]); + + OS::setEnvVars($proxyEnv); + } + + // $runArgs = $this->flags->getRawArgs(); // 会包含 arg: name + $runArgs = $this->flags->getRemainArgs(); + if (!$this->sr->isScriptName($name)) { + // - found script file if ($scriptFile = $this->sr->findScriptFile($name)) { $this->sr->runScriptFile($scriptFile, $runArgs); return; @@ -107,7 +122,7 @@ protected function execute(Input $input, Output $output) // - is an plugin if (Kite::plugManager()->isPlugin($name)) { $output->notice("input is an plugin name, will run plugin: $name"); - Kite::plugManager()->run($name, $this->app); + Kite::plugManager()->run($name, $this->app, $runArgs); return; } diff --git a/app/Console/Component/RedirectToGitGroup.php b/app/Console/Component/RedirectToGitGroup.php index 00b079a..af93a1a 100644 --- a/app/Console/Component/RedirectToGitGroup.php +++ b/app/Console/Component/RedirectToGitGroup.php @@ -2,12 +2,12 @@ namespace Inhere\Kite\Console\Component; -use Inhere\Console\Application; -use Inhere\Console\Console; +use Inhere\Console\Controller; use Inhere\Kite\Console\Controller\GitController; use Throwable; use Toolkit\Cli\Cli; use Toolkit\Stdlib\Obj\AbstractObj; +use function array_push; use function in_array; /** @@ -21,25 +21,35 @@ class RedirectToGitGroup extends AbstractObj public $cmdList = []; /** - * @param Application $app + * @param Controller $ctrl * @param string $action * @param array $args * * @return bool * @throws Throwable */ - public function handle(Application $app, string $action, array $args):bool + public function handle(Controller $ctrl, string $action, array $args): bool { + $app = $ctrl->getApp(); + // resolve alias $gitCtrl = $app->getController(GitController::getName()); $command = $gitCtrl->resolveAlias($action); - $redirectList = $this->cmdList; - if (in_array($command, $redirectList, true)) { - Cli::info("NOTICE: will redirect to git group for run `git $command`"); - // Console::app()->dispatch("git:$command"); - // Console::app()->dispatch("git:$command", $this->flags->getRawArgs()); - Console::app()->dispatch("git:$command", $args); + if (in_array($command, $this->cmdList, true)) { + Cli::info("NOTICE: will redirect to git group for run subcommand: $command"); + + $newArgs = []; + if ($ctrl->getFlags()->getOpt('dry-run')) { + $newArgs[] = '--dry-run'; + } + + $newArgs[] = $command; + // append remaining args + array_push($newArgs, ...$args); + + $app->dispatch('git', $newArgs); + // $app->dispatch("git:$command", $args); return true; } diff --git a/app/Console/Controller/GitController.php b/app/Console/Controller/GitController.php index acb644e..c2d2214 100644 --- a/app/Console/Controller/GitController.php +++ b/app/Console/Controller/GitController.php @@ -15,6 +15,7 @@ use Inhere\Console\IO\Output; use Inhere\Kite\Common\Cmd; use Inhere\Kite\Common\CmdRunner; +use Inhere\Kite\Common\GitLocal\GitHub; use Inhere\Kite\Console\Manage\GitBranchManage; use Inhere\Kite\Helper\AppHelper; use Inhere\Kite\Helper\GitUtil; @@ -146,7 +147,7 @@ protected function onNotFound(string $action, array $args): bool * update codes from origin by git pull * * @options - * --dir The want updated git repo dir. default is workdir + * --dir The want updated git repo dir. default is workdir * * @arguments * gitArgs Input more args or opts for run git @@ -156,25 +157,21 @@ protected function onNotFound(string $action, array $args): bool * @param Output $output * * @example - * {binWithCmd} --all -f --unshallow - * {binWithCmd} --dir /path/to/mydir -- --all -f --unshallow + * {binWithCmd} --all -f --unshallow + * {binWithCmd} --all -f --unshallow + * {binWithCmd} --dir /path/to/mydir -- --all -f --unshallow */ public function updateCommand(FlagsParser $fs, Input $input, Output $output): void { - $repoDir = $fs->getOpt('dir') ?: $input->getWorkDir(); - + $dir = $fs->getOpt('dir') ?: $input->getWorkDir(); $args = $fs->getRawArgs(); + $c = Cmd::git('pull'); - $c->setWorkDir($repoDir); + $c->setWorkDir($dir); $c->setDryRun($this->flags->getOpt('dry-run')); $c->addArgs(...$args); $c->run(true); - // $runner = CmdRunner::new(); - // $runner->setDryRun($input->getBoolOpt('dry-run')); - // $runner->add('git pull'); - // $runner->runAndPrint(); - $output->success('Complete'); } @@ -378,10 +375,11 @@ public function openCommand(FlagsParser $fs, Output $output): void * Clone an remote git repository to local * * @options - * --gh bool;Define the remote repository is on github + * --gh bool;Define the remote repository is on github + * -w, --workdir The clone work dir, default is current dir. * * @arguments - * repo The remote git repo URL or repository name + * repo string;The remote git repo URL or repository name;required * name The repository name at local, default is same `repo` * * @param FlagsParser $fs @@ -394,7 +392,37 @@ public function openCommand(FlagsParser $fs, Output $output): void */ public function cloneCommand(FlagsParser $fs, Output $output): void { - $output->success('TODO'); + $repo = $fs->getArg('repo'); + $name = $fs->getArg('name'); + $args = $fs->getRawArgs(); + + $dir = $fs->getOpt('workdir'); + + $c = Cmd::git('clone'); + $c->setWorkDir($dir); + $c->setDryRun($this->flags->getOpt('dry-run')); + + if ($fs->getOpt('gh')) { + $gh = GitHub::new($output); + + $repoUrl = $gh->parseRepoUrl($repo); + if (!$repoUrl) { + $output->error("invalid github 'repo' address: $repo"); + return; + } + } else { + $repoUrl = $repo; + } + + $c->add($repoUrl); + $c->addIf($name, $name); + if ($args) { + $c->addArgs(...$args); + } + + $c->runAndPrint(); + + $output->success('Complete'); } /** diff --git a/app/Console/Controller/GitHubController.php b/app/Console/Controller/GitHubController.php index c1c18ab..2ab361e 100644 --- a/app/Console/Controller/GitHubController.php +++ b/app/Console/Controller/GitHubController.php @@ -9,7 +9,6 @@ namespace Inhere\Kite\Console\Controller; -use Inhere\Console\Console; use Inhere\Console\Controller; use Inhere\Console\Exception\PromptException; use Inhere\Console\IO\Input; @@ -21,7 +20,6 @@ use PhpComp\Http\Client\Client; use Throwable; use Toolkit\PFlag\FlagsParser; -use function in_array; use function strtoupper; /** @@ -56,6 +54,18 @@ protected static function commandAliases(): array ]; } + /** + * @return string[] + */ + protected function options(): array + { + return [ + '--dry-run' => 'bool;Dry-run the workflow, dont real execute', + // '-y, --yes' => 'Direct execution without confirmation', + // '-i, --interactive' => 'Run in an interactive environment[TODO]', + ]; + } + /** * @return GitHub */ @@ -91,38 +101,9 @@ protected function onNotFound(string $action, array $args): bool 'cmdList' => $this->settings['redirectGit'] ?? [], ]); - return $h->handle($this->app, $action, $args); - - // resolve alias - // $gitCtrl = $this->app->getController(GitController::getName()); - // $command = $gitCtrl->resolveAlias($action); - // - // $redirectGitGroup = $this->settings['redirectGit'] ?? []; - // if (in_array($command, $redirectGitGroup, true)) { - // $this->output->notice("will redirect to git group for run `git $command`"); - // // Console::app()->dispatch("git:$command"); - // Console::app()->dispatch("git:$command", $args); - // return true; - // } - // - // return false; + return $h->handle($this, $action, $args); } - // protected function beforeAction(): bool - // { - // if ($this->app) { - // $action = $this->getAction(); - // - // $loadEnvActions = $this->settings['loadEnvOn'] ?? []; - // if ($loadEnvActions && in_array($action, $loadEnvActions, true)) { - // $this->output->info(self::getName() . ' - will load osEnv setting for command: ' . $action); - // AppHelper::loadOsEnvInfo($this->app); - // } - // } - // - // return true; - // } - /** * Show a list of commands that will be redirected to git * @@ -244,7 +225,7 @@ public function openCommand(FlagsParser $fs, Output $output): void * Clone an github repository to local * * @options - * -w, --workdir The clone work dir, defualt is current dir. + * -w, --workdir The clone work dir, default is current dir. * * @arguments * repo string;The remote git repo URL or repository name;required diff --git a/app/Console/Controller/GitLabController.php b/app/Console/Controller/GitLabController.php index 8d9a7df..0c93fcd 100644 --- a/app/Console/Controller/GitLabController.php +++ b/app/Console/Controller/GitLabController.php @@ -151,21 +151,7 @@ protected function onNotFound(string $action, array $args): bool 'cmdList' => $this->settings['redirectGit'] ?? [], ]); - return $h->handle($this->app, $action, $args); - // resolve alias - // $gitCtrl = $this->app->getController(GitController::getName()); - // $command = $gitCtrl->resolveAlias($action); - // - // $redirectGitGroup = $this->settings['redirectGit'] ?? []; - // if (in_array($command, $redirectGitGroup, true)) { - // $this->output->notice("will redirect to git group for run `git $command`"); - // // Console::app()->dispatch("git:$command"); - // // Console::app()->dispatch("git:$command", $this->flags->getRawArgs()); - // Console::app()->dispatch("git:$command", $args); - // return true; - // } - // - // return false; + return $h->handle($this, $action, $args); } /** @@ -586,19 +572,19 @@ public function resolveCommand(FlagsParser $fs, Output $output): void * -t, --target The target branch name * -o, --open Open the generated PR link on browser * -d, --direct bool;The PR is direct from fork to main repository - * --new Open new pr page on browser http://my.gitlab.com/group/repo/merge_requests/new + * --new bool;Open new pr page on browser. eg: http://my.gitlab.com/group/repo/merge_requests/new * * @argument - * project The project key in 'gitlab' config. eg: group-name, name + * project The project key in 'gitlab' config. eg: group-name, name * * @param FlagsParser $fs * @param Output $output * * @example - * {binWithCmd} Will generate PR link for fork 'HEAD_BRANCH' to main 'HEAD_BRANCH' - * {binWithCmd} -s 4_16 -t qa Will generate PR link for main 'PREFIX_4_16' to main 'qa' - * {binWithCmd} -t qa Will generate PR link for main 'HEAD_BRANCH' to main 'qa' - * {binWithCmd} -t qa --direct Will generate PR link for fork 'HEAD_BRANCH' to main 'qa' + * {binWithCmd} Will generate PR link for fork 'HEAD_BRANCH' to main 'HEAD_BRANCH' + * {binWithCmd} -s 4_16 -t qa Will generate PR link for main 'PREFIX_4_16' to main 'qa' + * {binWithCmd} -t qa Will generate PR link for main 'HEAD_BRANCH' to main 'qa' + * {binWithCmd} -t qa --direct Will generate PR link for fork 'HEAD_BRANCH' to main 'qa' */ public function pullRequestCommand(FlagsParser $fs, Output $output): void { diff --git a/app/Console/Controller/JsonController.php b/app/Console/Controller/JsonController.php index d891902..afd0c8c 100644 --- a/app/Console/Controller/JsonController.php +++ b/app/Console/Controller/JsonController.php @@ -12,6 +12,8 @@ use Inhere\Console\Controller; use Inhere\Console\IO\Input; use Inhere\Console\IO\Output; +use Inhere\Kite\Console\Component\Clipboard; +use InvalidArgumentException; use Toolkit\PFlag\FlagsParser; /** @@ -19,13 +21,15 @@ */ class JsonController extends Controller { - protected static $name = 'demo'; + protected static $name = 'json'; - protected static $description = 'Some useful development tool commands'; + protected static $description = 'Some useful json development tool commands'; - public static function isEnabled(): bool + protected static function commandAliases(): array { - return false; + return [ + 'toText' => ['2kv', 'to-kv', '2text'] + ]; } /** @@ -43,8 +47,67 @@ public static function isEnabled(): bool * @param FlagsParser $fs * @param Output $output */ - public function serveCommand(FlagsParser $fs, Output $output): void + public function loadCommand(FlagsParser $fs, Output $output): void { $output->success('Complete'); } + + /** + * search keywords in the loaded JSON data. + * + * @arguments + * keywords The keywords for search + * + * @options + * --type The search type. allow: keys, path + * + */ + public function searchCommand(): void + { + $cb = Clipboard::new(); + + $json = $cb->read(); + if (!$json) { + throw new InvalidArgumentException(''); + } + } + + /** + * multi line JSON logs. + */ + public function mlLogCommand(): void + { + $cb = Clipboard::new(); + + $json = $cb->read(); + if (!$json) { + throw new InvalidArgumentException(''); + } + } + + /** + * JSON to k-v text string. + */ + public function ml2lineCommand(): void + { + $cb = Clipboard::new(); + + $json = $cb->read(); + if (!$json) { + throw new InvalidArgumentException(''); + } + } + + /** + * JSON to k-v text string. + */ + public function toTextCommand(): void + { + $cb = Clipboard::new(); + + $json = $cb->read(); + if (!$json) { + throw new InvalidArgumentException(''); + } + } } diff --git a/app/Console/Controller/PluginController.php b/app/Console/Controller/PluginController.php index 98585c8..b12d410 100644 --- a/app/Console/Controller/PluginController.php +++ b/app/Console/Controller/PluginController.php @@ -110,6 +110,6 @@ public function runCommand(FlagsParser $fs, Output $output): void } } - $kpm->run($name, $this->app); + $kpm->run($name, $this->app, $fs->getRemainArgs()); } } diff --git a/app/Console/Controller/UtilController.php b/app/Console/Controller/UtilController.php index abab6eb..f9f3f28 100644 --- a/app/Console/Controller/UtilController.php +++ b/app/Console/Controller/UtilController.php @@ -11,14 +11,13 @@ use Inhere\Console\Controller; use Inhere\Console\IO\Output; +use Inhere\Kite\Console\Component\Clipboard; use Inhere\Kite\Kite; use Toolkit\PFlag\FlagsParser; use function date; use function explode; use function implode; -use function strlen; use function strtotime; -use function substr; use function time; use function trim; @@ -77,8 +76,12 @@ public function joinCommand(FlagsParser $fs, Output $output): void { $text = trim($fs->getArg(0)); if (!$text) { - $output->colored('empty text'); - return; + $text = Clipboard::new()->read(); + + if (!$text) { + $output->colored('empty text'); + return; + } } $lines = explode("\n", $text); diff --git a/app/Console/Listener/BeforeCommandRunListener.php b/app/Console/Listener/BeforeCommandRunListener.php index 5973dee..eb493e9 100644 --- a/app/Console/Listener/BeforeCommandRunListener.php +++ b/app/Console/Listener/BeforeCommandRunListener.php @@ -55,22 +55,20 @@ class BeforeCommandRunListener extends AbstractObj public function __invoke(AbstractHandler $handler) { $input = $handler->getInput(); - $alone = $handler->isAlone(); - - $this->autoSetProxyEnv($input, $alone, $handler::getName()); + $this->autoSetProxyEnv($input, $handler); } /** - * @param Input $input - * @param bool $alone - * @param string $commandName + * @param Input $input + * @param AbstractHandler $handler */ - protected function autoSetProxyEnv(Input $input, bool $alone, string $commandName): void + protected function autoSetProxyEnv(Input $input, AbstractHandler $handler): void { if (!$this->envSettings) { return; } + $alone = $handler->isAlone(); $cmdId = $input->getCommandId(); if ($this->commandIds && in_array($cmdId, $this->commandIds, true)) { @@ -78,10 +76,8 @@ protected function autoSetProxyEnv(Input $input, bool $alone, string $commandNam return; } - $groupName = $input->getCommand(); - // vdump($groupName, $this); + $groupName = $handler->getGroupName(); if (!$alone && isset($this->groupLimits[$groupName])) { - // vdump($commandName, $cmdId , $input); if (!$this->groupLimits[$groupName]) { $this->setProxyEnv($this->envSettings, $cmdId); return; diff --git a/app/Console/Listener/NotFoundListener.php b/app/Console/Listener/NotFoundListener.php index 2a6e4a4..05f3489 100644 --- a/app/Console/Listener/NotFoundListener.php +++ b/app/Console/Listener/NotFoundListener.php @@ -6,7 +6,11 @@ use Inhere\Kite\Common\CmdRunner; use Inhere\Kite\Console\CliApplication; use Inhere\Kite\Kite; +use Throwable; +use Toolkit\Stdlib\Helper\DataHelper; use Toolkit\Sys\Sys; +use function array_merge; +use function array_shift; /** * Class NotFoundListener @@ -16,10 +20,11 @@ final class NotFoundListener { /** - * @param string $cmd + * @param string $cmd * @param CliApplication $app * * @return bool + * @throws Throwable * @see ConsoleEvent::ON_NOT_FOUND */ public function __invoke(string $cmd, CliApplication $app): bool @@ -41,16 +46,16 @@ public function __invoke(string $cmd, CliApplication $app): bool if ($sr->isScriptName($cmd)) { $this->runCustomScript($cmd, $app); - } elseif (Kite::plugManager()->isPlugin($cmd)) { - // - is an plugin - $app->notice("input is an plugin name, will run plugin: $cmd"); - - Kite::plugManager()->run($cmd, $app); - } elseif ($sFile = $sr->findScriptFile($cmd)) { - // - is script file - $app->notice("input is an script file, will call it: $cmd"); + } elseif (Kite::plugManager()->isPlugin($cmd)) { // - is an plugin + $args = $app->getInput()->getFlags(); + array_shift($args); // first is $cmd + $app->notice("input is an plugin name, will run plugin: $cmd, args: " . DataHelper::toString($args)); + Kite::plugManager()->run($cmd, $app, $args); + } elseif ($sFile = $sr->findScriptFile($cmd)) { // - is script file $args = $app->getInput()->getArgs(); + $app->notice("input is an script file, will call it: $cmd, args: " . DataHelper::toString($args)); + $sr->runScriptFile($sFile, $args); } else { // - call system command. @@ -83,8 +88,10 @@ private function callSystemCmd(string $cmd, CliApplication $app): void } /** - * @param string $cmd + * @param string $cmd * @param CliApplication $app + * + * @throws Throwable */ private function runCustomScript(string $cmd, CliApplication $app): void { diff --git a/app/Console/Plugin/AbstractPlugin.php b/app/Console/Plugin/AbstractPlugin.php index 884f243..a7cdfc6 100644 --- a/app/Console/Plugin/AbstractPlugin.php +++ b/app/Console/Plugin/AbstractPlugin.php @@ -4,6 +4,9 @@ use Inhere\Console\Application; use Inhere\Console\IO\Input; +use Toolkit\PFlag\Flags; +use Toolkit\PFlag\FlagsParser; +use Toolkit\PFlag\SFlags; use function array_merge; /** @@ -13,6 +16,11 @@ */ abstract class AbstractPlugin implements PluginInterface { + /** + * @var FlagsParser + */ + protected $fs; + /** * @var string */ @@ -43,6 +51,24 @@ public function init(): void ], $this->metadata()); } + /** + * @return Flags + */ + protected function createFlags(): Flags + { + $this->fs = new Flags(); + return $this->fs; + } + + /** + * @return SFlags + */ + protected function createSFlags(): SFlags + { + $this->fs = new SFlags(); + return $this->fs; + } + /** * Metadata for the plugin * @@ -59,11 +85,23 @@ public function metadata(): array } /** - * options for the plugin + * flag options for the plugin * * @return array */ public function options(): array + { + return [ + // 'file' => 'string;the Idea Http Request file', + ]; + } + + /** + * flag arguments for the plugin + * + * @return array + */ + public function arguments(): array { return [ // 'file' => 'the Idea Http Request file', @@ -120,9 +158,10 @@ public function getSimpleInfo(): array * @param Application $app * @param Input $input */ - public function run(Application $app, Input $input): void + public function run(Application $app, array $args = []): void { - if (!$this->beforeRun($app, $input)) { + $input = $app->getInput(); + if (!$this->beforeRun($app, $args)) { return; } @@ -131,11 +170,11 @@ public function run(Application $app, Input $input): void /** * @param Application $app - * @param Input $input + * @param array $args * * @return bool */ - protected function beforeRun(Application $app, Input $input): bool + protected function beforeRun(Application $app, array $args): bool { return true; } diff --git a/app/Console/Plugin/PluginManager.php b/app/Console/Plugin/PluginManager.php index 89e83bc..1b11e40 100644 --- a/app/Console/Plugin/PluginManager.php +++ b/app/Console/Plugin/PluginManager.php @@ -79,23 +79,18 @@ public function __construct(array $pluginDirs = []) } /** - * @param string $name plugin name or file path + * @param string $name plugin name or file path * @param Application $app + * @param array $args */ - public function run(string $name, Application $app): void + public function run(string $name, Application $app, array $args = []): void { $plugin = $this->getPlugin($name); if (!$plugin) { - throw new RuntimeException('the plugin is not exists. plugin: ' . $name); - } - - $input = $app->getInput(); - if ($input->getSameBoolOpt('h,help')) { - $this->showInfo($plugin); - return; + throw new RuntimeException("the plugin '$name' is not exists. plugin: "); } - $plugin->run($app, $input); + $plugin->run($app, $args); } /** diff --git a/config/config.php b/config/config.php index 3f6da14..7d77496 100644 --- a/config/config.php +++ b/config/config.php @@ -67,6 +67,9 @@ // 'baseUrl' => '', ], 'osEnv' => [ + // env settings + ], + 'proxyEnv' => [ // proxy settings // 'http_proxy' => 'http://127.0.0.1:1081', // 'https_proxy' => 'http://127.0.0.1:1081',