Skip to content

Commit

Permalink
feat(CommitCommand): Add option to regenerate commit
Browse files Browse the repository at this point in the history
- Added an option to regenerate commit
- If selected, the commit command will be executed again
  • Loading branch information
guanguans committed Jul 24, 2023
1 parent 28d571b commit 11de1bc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/Commands/CommitCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,15 @@ function ($attempts) use ($cachedDiff): string {
->pipe(function (Collection $messages) {
$subject = $this->choice(
'Please choice a commit message',
$messages->pluck('subject', 'id')->all(),
$messages->pluck('subject', 'id')->add($regeneratePhrase = '<comment>regenerate</comment>')->all(),
'1'
);

if ($subject === $regeneratePhrase) {
$this->output->note('regenerating...');
$this->handle();
}

return $messages->firstWhere('subject', $subject) ?? [];
});
}, 'choosing...');
Expand Down

0 comments on commit 11de1bc

Please sign in to comment.