-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
👔 up: update git, gitlab, github some sub commands logic
- Loading branch information
Showing
15 changed files
with
200 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Inhere\Kite\Console\SubCmd\GitxCmd; | ||
|
||
use Inhere\Console\Command; | ||
use Inhere\Console\IO\Input; | ||
use Inhere\Console\IO\Output; | ||
use Throwable; | ||
use Toolkit\PFlag\FlagsParser; | ||
|
||
/** | ||
* Class BranchCmd | ||
*/ | ||
class BatchCmd extends Command | ||
{ | ||
protected static string $name = 'batch'; | ||
protected static string $desc = 'batch run or handle git commands'; | ||
|
||
public static function aliases(): array | ||
{ | ||
return ['bat']; | ||
} | ||
|
||
protected function subCommands(): array | ||
{ | ||
return [ | ||
BatchStatusCmd::class, | ||
BatchRunCmd::class, | ||
]; | ||
} | ||
|
||
protected function configFlags(FlagsParser $fs): void | ||
{ | ||
// $this->flags->addOptByRule($name, $rule); | ||
} | ||
|
||
/** | ||
* Do execute command | ||
* | ||
* @param Input $input | ||
* @param Output $output | ||
* | ||
* @throws Throwable | ||
*/ | ||
protected function execute(Input $input, Output $output): void | ||
{ | ||
// default run | ||
$this->showHelp(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Inhere\Kite\Console\SubCmd\GitxCmd; | ||
|
||
use Inhere\Console\Command; | ||
use Inhere\Console\IO\Input; | ||
use Inhere\Console\IO\Output; | ||
use PhpGit\Git; | ||
use Toolkit\FsUtil\Dir; | ||
use Toolkit\PFlag\FlagsParser; | ||
|
||
/** | ||
* Class BranchDeleteCmd | ||
* | ||
* @package Inhere\Kite\Console\Controller\Gitlab | ||
*/ | ||
class BatchStatusCmd extends Command | ||
{ | ||
protected static string $name = 'status'; | ||
protected static string $desc = 'quick check git status for multi repository dir'; | ||
|
||
public static function aliases(): array | ||
{ | ||
return ['st']; | ||
} | ||
|
||
protected function configFlags(FlagsParser $fs): void | ||
{ | ||
// $this->flags->addOptByRule($name, $rule); | ||
} | ||
|
||
/** | ||
* @options | ||
* -i, --include Include match filter | ||
* -e, --exclude Exclude match filter | ||
* | ||
* @arguments | ||
* dirs... array;The parent dir for multi git repository;required | ||
* | ||
* @param Input $input | ||
* @param Output $output | ||
* | ||
* @return int | ||
*/ | ||
protected function execute(Input $input, Output $output): int | ||
{ | ||
$fs = $this->flags; | ||
$dirs = $fs->getArg('dirs'); | ||
|
||
foreach ($dirs as $dir) { | ||
$output->colored("In the parent dir: " . $dir); | ||
|
||
foreach (Dir::getDirs($dir) as $subDir) { | ||
$gitDir = Dir::join($dir, $subDir); | ||
$output->colored("- In the git repo dir: " . $gitDir); | ||
|
||
Git::new($gitDir)->status->display(); | ||
} | ||
} | ||
|
||
return 0; | ||
} | ||
} |
Oops, something went wrong.