Skip to content

Commit

Permalink
👔 up: update the git ac, up commands logic
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Dec 29, 2022
1 parent 033386f commit 69ce317
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion app/Console/SubCmd/Gitflow/UpdateNoPushCmd.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Inhere\Console\IO\Output;
use Throwable;
use Toolkit\PFlag\FlagsParser;
use function array_unshift;

/**
* Class UpdateNoPushCmd
Expand Down Expand Up @@ -44,9 +45,10 @@ protected function configFlags(FlagsParser $fs): void
protected function execute(Input $input, Output $output): int
{
$flags = $this->flags->getFlags();
$flags[] = '--np';
array_unshift($flags, '--np');

$upCmd = new UpdatePushCmd($input, $output);
$upCmd->setParent($this->getParent());
$upCmd->run($flags);

return 0;
Expand Down
2 changes: 2 additions & 0 deletions app/Console/SubCmd/Gitflow/UpdatePushCmd.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ protected function execute(Input $input, Output $output): int

if ($gx->getRepo()->hasBranch($upBranch, $mainRemote)) {
$runner->addf('git pull %s %s', $mainRemote, $upBranch);
} else {
$runner->addf('git fetch %s -np', $mainRemote);
}

$defBranch = $gx->getDefaultBranch();
Expand Down
4 changes: 3 additions & 1 deletion app/Console/SubCmd/GitxCmd/AddCommitCmd.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Inhere\Console\IO\Input;
use Inhere\Console\IO\Output;
use Throwable;
use function array_unshift;

/**
* class AddCommitCmd
Expand Down Expand Up @@ -39,9 +40,10 @@ public static function aliases(): array
protected function execute(Input $input, Output $output): void
{
$flags = $this->flags->getFlags();
$flags[] = '--np';
array_unshift($flags, '--np');

$upCmd = new AddCommitPushCmd($input, $output);
$upCmd->setParent($this->getParent());
$upCmd->run($flags);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @license MIT
*/

namespace Inhere\Kite\Console\Command;
namespace Inhere\Kite\Console\SubCmd;

use Inhere\Console\Command;
use Inhere\Console\IO\Input;
Expand Down

0 comments on commit 69ce317

Please sign in to comment.