Skip to content

Commit

Permalink
upsome commands
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Jun 15, 2020
1 parent ffa9f68 commit 7ce42d7
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 28 deletions.
11 changes: 8 additions & 3 deletions app/Console/Command/DocCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ protected function execute($input, $output)

$topic = $man->findTopic($this->topName, $this->subNames);
if (!$topic) {
if ($input->getBoolOpt('create')) {
$this->createTopic($output);
return;
}

$output->error('The topic is not found! #' . $nameString);
return;
}
Expand Down Expand Up @@ -158,11 +163,11 @@ protected function execute($input, $output)
}

/**
*
* @param Output $output
*/
private function createTopic(): void
private function createTopic(Output $output): void
{

$output->notice('TODO');
}

/**
Expand Down
13 changes: 7 additions & 6 deletions app/Console/Controller/GitLabController.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ protected function prLinkConfigure(Input $input): void
* -s, --source The source branch
* -t, --target The target branch
* -o, --open Open the generated PR link on browser
* --sync The target branch will same source branch
* --direct The PR is from fork to main repository
*
* @argument
* project The project key in 'gitlab' config. eg: group-name, name
Expand All @@ -158,10 +158,10 @@ protected function prLinkConfigure(Input $input): void
* @param Output $output
*
* @example
* {binWithCmd} -s 4_16 -t qa Will generate PR link for fork 'PREFIX_4_16' to main 'qa'
* {binWithCmd} -t qa Will generate PR link for fork 'HEAD_BRANCH' to main 'qa'
* {binWithCmd} -s 4_16 --sync Will generate PR link for fork 'PREFIX_4_16' to main 'PREFIX_4_16'
* {binWithCmd} --sync Will generate PR link for fork 'HEAD_BRANCH' to main 'HEAD_BRANCH'
* {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 prLinkCommand(Input $input, Output $output): void
{
Expand Down Expand Up @@ -222,7 +222,8 @@ public function prLinkCommand(Input $input, Output $output): void
}

// Is sync to remote
if ($srcBranch === $tgtBranch) {
$isDirect = $input->getBoolOpt('direct');
if ($isDirect || $srcBranch === $tgtBranch) {
$group = $pjInfo['forkGroup'] ?? $this->config['defaultForkGroup'];
} else {
$srcPjId = $tgtPjId;
Expand Down
21 changes: 2 additions & 19 deletions app/Console/Controller/GitLocController.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public function tagFindCommand(Input $input, Output $output): void

if ($nextTag) {
$title = "<info>The next tag version</info>: <b>%s</b> (current: {$tagName})";
$tagName = $this->buildNextTag($tagName);
$tagName = GitUtil::buildNextTag($tagName);
}

if ($onlyTag) {
Expand All @@ -130,23 +130,6 @@ public function tagFindCommand(Input $input, Output $output): void
$output->printf($title, $tagName);
}

/**
* Get next tag version. eg: v2.0.3 => v2.0.4
*
* @param string $tagName
*
* @return string
*/
private function buildNextTag(string $tagName): string
{
$nodes = explode('.', $tagName);

$lastNum = array_pop($nodes);
$nodes[] = (int)$lastNum + 1;

return implode('.', $nodes);
}

/**
* list all git tags for the project
*
Expand Down Expand Up @@ -197,7 +180,7 @@ public function tagPushCommand(Input $input, Output $output): void
return;
}

$tag = $this->buildNextTag($lTag);
$tag = GitUtil::buildNextTag($lTag);
} else {
$tag = $input->getSameOpt(['v', 'version'], '');
if (!$tag) {
Expand Down
19 changes: 19 additions & 0 deletions app/Helper/GitUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
use Toolkit\Cli\Color;
use Toolkit\Sys\Sys;
use function array_filter;
use function array_pop;
use function explode;
use function implode;
use function sprintf;
use function str_replace;
use function trim;
Expand Down Expand Up @@ -146,6 +148,23 @@ public static function findTag(string $workDir = '', bool $showInfo = false): st
return trim($tagName);
}

/**
* Get next tag version. eg: v2.0.3 => v2.0.4
*
* @param string $tagName
*
* @return string
*/
public static function buildNextTag(string $tagName): string
{
$nodes = explode('.', $tagName);

$lastNum = array_pop($nodes);
$nodes[] = (int)$lastNum + 1;

return implode('.', $nodes);
}

/**
* @param string $remote
* @param string $tag
Expand Down
8 changes: 8 additions & 0 deletions resource/mandocs/en/mysql/between.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# between

the between usage:

```sql
select * from my_table WHERE `field` BETWEEN value1 AND value2;
select * from my_table WHERE `field` NOT BETWEEN value1 AND value2
```

0 comments on commit 7ce42d7

Please sign in to comment.