Skip to content

Commit

Permalink
Merge pull request #13 from hwixley/commit-intelligence-zsh-support
Browse files Browse the repository at this point in the history
GPT-commit: Refactor wix-cli.sh for improved commit intelligence.
  • Loading branch information
hwixley authored Jul 5, 2023
2 parents 3ea8bf6 + b12bdaf commit 7d1bd12
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions wix-cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,21 @@ commit() {
if grep -q "OPENAI_API_KEY=" "${datadir}/.env" && grep -q "USE_SMART_COMMIT=true" "${datadir}/.env" ; then
IFS=$'\n' lines=($(python3 "$scriptdir/services/openai_service.py" "smart"))
h2_text "GPT-3 Suggestion"
h2_text "Title:${RESET} ${lines[0]}"
h2_text "Description:${RESET} ${lines[1]}"
echo ""
info_text "Press enter to use this suggestion or type your own description."
read -r description
git commit -m "${description:-${lines[0]}}" -m "${lines[1]}"
if using_zsh; then
h2_text "Title:${RESET} ${lines[1]}"
h2_text "Description:${RESET} ${lines[2]}"
echo ""
info_text "Press enter to use this suggestion or type your own description."
read -r description
git commit -m "${description:-${lines[1]}}" -m "${lines[2]}"
else
h2_text "Title:${RESET} ${lines[0]}"
h2_text "Description:${RESET} ${lines[1]}"
echo ""
info_text "Press enter to use this suggestion or type your own description."
read -r description
git commit -m "${description:-${lines[0]}}" -m "${lines[1]}"
fi
else
info_text "Provide a commit description: (defaults to 'wix-cli quick commit')"
read -r description
Expand Down

0 comments on commit 7d1bd12

Please sign in to comment.