From dfcd47b5814aadf05f198fe8623e7885dc5b2033 Mon Sep 17 00:00:00 2001 From: zewelor Date: Fri, 20 Sep 2024 09:59:51 +0200 Subject: [PATCH] Display generated commit message for commit process, including a confirmation prompt for user acceptance. --- .zsh/shell_gpt.zsh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.zsh/shell_gpt.zsh b/.zsh/shell_gpt.zsh index 6a4c51f..a6c2bb5 100644 --- a/.zsh/shell_gpt.zsh +++ b/.zsh/shell_gpt.zsh @@ -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." @@ -89,6 +95,7 @@ if has "sgpt"; then fi } + gsumpoa() { git add . && gsum "$@" && git push -u origin }