Skip to content

Commit

Permalink
update some comands
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed May 29, 2020
1 parent ed5f74d commit 1b7c31b
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 37 deletions.
2 changes: 1 addition & 1 deletion app/Console/Group/DemoGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ class DemoGroup extends Controller
*/
public function serveCommand(Input $input, Output $output): void
{
echo "string\n";
$output->success('Complete');
}
}
2 changes: 1 addition & 1 deletion app/Console/Group/GitFlowGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,6 @@ public function syncCommand(Input $input, Output $output): void
$cmd = CmdRunner::new($str);
$cmd->do();

$output->info('Complete');
$output->success('Complete');
}
}
13 changes: 8 additions & 5 deletions app/Console/Group/GitGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class GitGroup extends Controller
{
protected static $name = 'git';

protected static $description = 'Some useful tool commands for git flow development';
protected static $description = 'Some useful tool commands for quick use git';

public static function aliases(): array
{
Expand All @@ -38,10 +38,13 @@ public static function aliases(): array
protected static function commandAliases(): array
{
return [
'tl' => 'tagList',
'taglist' => 'tagList',
'tag-find' => 'tagFind',
'tag:find' => 'tagFind',
'tagfind' => 'tagFind',
'tagpush' => 'tagPush',
'tp' => 'tagPush',
'tag-push' => 'tagPush',
'tag:push' => 'tagPush',
'tag:del' => 'tagDelete',
Expand Down Expand Up @@ -83,7 +86,7 @@ public function tagFindCommand(Input $input, Output $output): void
$title = 'The latest tag: %s';

if ($nextTag) {
$title = "The next tag: %s (current: {$tagName})";
$title = "The next tag: %s (current: {$tagName})";
$tagName = $this->buildNextTag($tagName);
}

Expand Down Expand Up @@ -149,7 +152,7 @@ public function tagPushCommand(Input $input, Output $output): void
$output->aList([
'Work Dir' => $input->getPwd(),
'New Tag' => $input->getSameOpt(['v', 'tag']),
], 'Information');
], 'Information', ['ucFirst' => false]);

$msg = $input->getSameArg(['m', 'message']);
$msg = $msg ?: "Release $tag";
Expand Down Expand Up @@ -183,7 +186,7 @@ public function tagDeleteCommand(Input $input, Output $output): void

GitUtil::delRemoteTag($remote, $tag);

$output->info('Complete');
$output->success('Complete');
}

/**
Expand All @@ -210,6 +213,6 @@ public function ampCommand(Input $input, Output $output): void
$run->okDoRun(sprintf('git commit -m "%s"', $message));
$run->okDoRun('git push');

$output->info('Complete');
$output->success('Complete');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
use Inhere\Console\IO\Output;

/**
* Class SnippetsGroup
* Class SnippetGroup
*/
class SnippetsGroup extends Controller
class SnippetGroup extends Controller
{
protected static $name = 'snippet';

Expand All @@ -31,21 +31,12 @@ public static function aliases(): array
}

/**
* run a php built-in server for development(is alias of the command 'server:dev')
*
* @usage
* {command} [-S HOST:PORT]
* {command} [-H HOST] [-p PORT]
*
* @options
* -S The server address. e.g 127.0.0.1:5577
* -H,--host The server host address. e.g 127.0.0.1
* -p,--port The server host address. e.g 5577
* list all code snippets
*
* @param Input $input
* @param Output $output
*/
public function serveCommand(Input $input, Output $output): void
public function listCommand(Input $input, Output $output): void
{
echo "string\n";
}
Expand Down
37 changes: 37 additions & 0 deletions app/Console/Group/UtilGroup.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php declare(strict_types=1);
/**
* This file is part of Kite.
*
* @link https://github.com/inhere
* @author https://github.com/inhere
* @license MIT
*/

namespace Inhere\Kite\Console\Group;

use Inhere\Console\Controller;
use Inhere\Console\IO\Input;
use Inhere\Console\IO\Output;
use function date;

/**
* Class DemoGroup
*/
class UtilGroup extends Controller
{
protected static $name = 'util';

protected static $description = 'Some useful development tool commands';

/**
* print current datetime
*
* @param Input $input
* @param Output $output
*/
public function dateCommand(Input $input, Output $output): void
{
$output->println('Time: ' . date('Y-m-d H:i:s'));
// $output->success('Complete');
}
}
17 changes: 0 additions & 17 deletions app/Console/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,3 @@

// $app->addCommand(\Inhere\Console\BuiltIn\DevServerCommand::class);
$app->addController(\Inhere\Console\BuiltIn\PharController::class);

$app->addCommand('cur:time', static function ($in, $out) {
$time = time();
$out->println([
date('Y-m-d H:i:s', $time),
]);
}, [
'aliases' => ['curtime'],
'description' => 'print current time',
]);

$app->addCommand('calc', static function ($in, $out) {
$out->println('TODO');
}, [
// 'aliases' => ['curtime'],
'description' => 'simple expr execute',
]);

0 comments on commit 1b7c31b

Please sign in to comment.