From 1b7c31b771c027c053017393955822021a2c588a Mon Sep 17 00:00:00 2001 From: inhere Date: Fri, 29 May 2020 10:58:20 +0800 Subject: [PATCH] update some comands --- app/Console/Group/DemoGroup.php | 2 +- app/Console/Group/GitFlowGroup.php | 2 +- app/Console/Group/GitGroup.php | 13 ++++--- .../{SnippetsGroup.php => SnippetGroup.php} | 17 ++------- app/Console/Group/UtilGroup.php | 37 +++++++++++++++++++ app/Console/routes.php | 17 --------- 6 files changed, 51 insertions(+), 37 deletions(-) rename app/Console/Group/{SnippetsGroup.php => SnippetGroup.php} (57%) create mode 100644 app/Console/Group/UtilGroup.php diff --git a/app/Console/Group/DemoGroup.php b/app/Console/Group/DemoGroup.php index 40c0bbe..f7ca274 100644 --- a/app/Console/Group/DemoGroup.php +++ b/app/Console/Group/DemoGroup.php @@ -39,6 +39,6 @@ class DemoGroup extends Controller */ public function serveCommand(Input $input, Output $output): void { - echo "string\n"; + $output->success('Complete'); } } diff --git a/app/Console/Group/GitFlowGroup.php b/app/Console/Group/GitFlowGroup.php index a58a88c..4af6d36 100644 --- a/app/Console/Group/GitFlowGroup.php +++ b/app/Console/Group/GitFlowGroup.php @@ -104,6 +104,6 @@ public function syncCommand(Input $input, Output $output): void $cmd = CmdRunner::new($str); $cmd->do(); - $output->info('Complete'); + $output->success('Complete'); } } diff --git a/app/Console/Group/GitGroup.php b/app/Console/Group/GitGroup.php index dbef4b5..f455810 100644 --- a/app/Console/Group/GitGroup.php +++ b/app/Console/Group/GitGroup.php @@ -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 { @@ -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', @@ -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); } @@ -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"; @@ -183,7 +186,7 @@ public function tagDeleteCommand(Input $input, Output $output): void GitUtil::delRemoteTag($remote, $tag); - $output->info('Complete'); + $output->success('Complete'); } /** @@ -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'); } } diff --git a/app/Console/Group/SnippetsGroup.php b/app/Console/Group/SnippetGroup.php similarity index 57% rename from app/Console/Group/SnippetsGroup.php rename to app/Console/Group/SnippetGroup.php index 356756c..003af75 100644 --- a/app/Console/Group/SnippetsGroup.php +++ b/app/Console/Group/SnippetGroup.php @@ -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'; @@ -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"; } diff --git a/app/Console/Group/UtilGroup.php b/app/Console/Group/UtilGroup.php new file mode 100644 index 0000000..c2889f7 --- /dev/null +++ b/app/Console/Group/UtilGroup.php @@ -0,0 +1,37 @@ +println('Time: ' . date('Y-m-d H:i:s')); + // $output->success('Complete'); + } +} diff --git a/app/Console/routes.php b/app/Console/routes.php index 1e04937..3582aab 100644 --- a/app/Console/routes.php +++ b/app/Console/routes.php @@ -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', -]);