Skip to content

Commit

Permalink
up: update soem for gitlab and run command
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Sep 19, 2022
1 parent 8ab9e9b commit b10966f
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 21 deletions.
4 changes: 2 additions & 2 deletions app/Console/Attach/Gitlab/MergeRequestCmd.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ protected function execute(Input $input, Output $output): mixed
$srcBranch = $curBranch;
}

$open = $fs->getOpt('open');
$open = $gl->getRealBranchName($fs->getOpt('open'));
// if input '@', 'head', use current branch name.
if ($open) {
if ($open === '@' || strtoupper($open) === 'HEAD') {
Expand Down Expand Up @@ -159,7 +159,7 @@ protected function execute(Input $input, Output $output): mixed
if ($open) {
// $output->info('will auto open link on browser');
AppHelper::openBrowser($link);
$output->success('Complete');
$output->success('Complete. at ' . date('Y-m-d H:i:s'));
} else {
$output->colored("PR LINK: ");
$output->writeln(' ' . $link);
Expand Down
43 changes: 24 additions & 19 deletions app/Console/Command/RunCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ protected function beforeExecute(): bool

/**
* @options
* -l, --list List information for all scripts or script files. type: file, cmd(default)
* -s, --search Display all matched scripts by the input name
* -l, --list List information for all scripts or script files. type: file, cmd
* -i, --info Show information for give script name or script file
* --dry-run bool;Mock running, not real execute.
* -p, --proxy bool;Enable proxy ENV setting
Expand Down Expand Up @@ -199,24 +198,30 @@ private function listScripts(Output $output, string $name): void
'filterEmpty' => true,
];

if ($name && $this->sr->isScriptName($name)) {
$desc = '';
$item = $this->sr->getScript($name);

// [_meta => [desc, ]]
if (is_array($item) && isset($item['_meta'])) {
$meta = $item['_meta'];
unset($item['_meta']);

$desc = $meta['desc'] ?? '';
// $output->colored(ucfirst($desc), 'cyan');
if ($name) {
if ($this->sr->isScriptName($name)) {
$desc = '';
$item = $this->sr->getScript($name);

// [_meta => [desc, ]]
if (is_array($item) && isset($item['_meta'])) {
$meta = $item['_meta'];
unset($item['_meta']);

$desc = $meta['desc'] ?? '';
// $output->colored(ucfirst($desc), 'cyan');
}

$output->aList([
'name' => $name,
'desc' => $desc,
'command' => $item,
], "Script: $name", $listOpt);
} else {
$matched = $this->sr->searchScripts($name);
$number = \count($matched);
$output->aList($matched, "'$name' matched scripts(number: $number)", $listOpt);
}

$output->aList([
'name' => $name,
'desc' => $desc,
'command' => $item,
], "Script: $name", $listOpt);
} else {
$count = $this->sr->getScriptCount();
$output->aList($this->sr->getScripts(), "registered scripts(total: $count)", $listOpt);
Expand Down
6 changes: 6 additions & 0 deletions app/Http/WebApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

use Inhere\Kite\Concern\InitApplicationTrait;
use Inhere\Kite\Kite;
use Inhere\Route\Dispatcher\Dispatcher;
use Inhere\Route\Router;
use PhpPkg\EasyTpl\EasyTemplate;
use Throwable;
Expand Down Expand Up @@ -98,6 +99,11 @@ public function run(): void
try {
$dispatcher = Kite::dispatcher();

// 成功匹配路由
$dispatcher->on(Dispatcher::ON_FOUND, function ($uri, $cb) {
Kite::logger()->debug("Matched uri path: $uri, setting callback is: " . is_string($cb) ? $cb : get_class($cb));
});

Kite::webRouter()->dispatch($dispatcher);
} catch (Throwable $e) {
(new ErrorHandler((bool)$this->params['debug']))->run($e);
Expand Down

0 comments on commit b10966f

Please sign in to comment.