Skip to content

Commit

Permalink
Display generated commit message for commit process, including a conf…
Browse files Browse the repository at this point in the history
…irmation prompt for user acceptance.
  • Loading branch information
zewelor committed Sep 20, 2024
1 parent 1e895e3 commit dfcd47b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion .zsh/shell_gpt.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,16 @@ if has "sgpt"; then

commit_message="$(echo "$git_changes" | sgpt "$query")"

# Display the commit message
echo "Generated Commit Message:"
echo "-------------------------"
echo "$commit_message"
echo "-------------------------"

if [ "$auto_accept" = true ]; then
git commit -m "$commit_message"
else
printf "%s\n\nDo you want to accept this commit? [Y/n] " "$commit_message"
printf "Do you want to accept this commit? [Y/n] "
read -r response
if [[ $response =~ ^[Nn]$ ]]; then
echo "Commit cancelled."
Expand All @@ -89,6 +95,7 @@ if has "sgpt"; then
fi
}


gsumpoa() {
git add . && gsum "$@" && git push -u origin
}
Expand Down

0 comments on commit dfcd47b

Please sign in to comment.