Skip to content

Commit

Permalink
remove commit part
Browse files Browse the repository at this point in the history
  • Loading branch information
salehhashemi1992 committed May 16, 2023
1 parent b2a2cdf commit 3f43cfd
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions src/Console/AiCommitCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function handle(): int

try {
$commitDetails = $this->fetchAiGeneratedContent($prompt);
$this->commit($commitDetails);
$this->result($commitDetails);
} catch (InvalidArgumentException $e) {
$this->error('An error occurred when generating the commit message: '.$e->getMessage());

Expand Down Expand Up @@ -193,20 +193,9 @@ private function fetchAiGeneratedContent(string $prompt): array
/**
* Commit the changes.
*/
private function commit(array $commitDetails): void
private function result(array $commitDetails): void
{
$this->line("<bg=blue;options=bold>Title</>\n<fg=Cyan>{$commitDetails['title']}</>");
$this->line("<bg=blue;options=bold>Description</>\n<fg=Cyan>{$commitDetails['description']}</>");

if ($this->confirm('Do you wish to commit these changes?')) {
$process = Process::fromShellCommandline('git commit -m "'.$commitDetails['title'].'" -m "'.$commitDetails['description'].'"');
$process->run();

if (! $process->isSuccessful()) {
throw new ProcessFailedException($process);
}

$this->info('Changes committed successfully.');
}
}
}

0 comments on commit 3f43cfd

Please sign in to comment.