summaryrefslogtreecommitdiff
path: root/functions/ia-commit.fish
diff options
context:
space:
mode:
authorache <ache@ache.one>2026-01-05 01:17:52 +0100
committerache <ache@ache.one>2026-01-05 01:17:52 +0100
commitff34ab27171bb1873b1418edd5a355f452a459ba (patch)
treee26bc4df55f5464f4958ee347333ac4f6bd343d3 /functions/ia-commit.fish
parentfeat: Exit with error code when user doesn't want to commit changes (diff)
docs: improve commit message prompt and handle response codes consistently
Diffstat (limited to 'functions/ia-commit.fish')
-rwxr-xr-xfunctions/ia-commit.fish9
1 files changed, 7 insertions, 2 deletions
diff --git a/functions/ia-commit.fish b/functions/ia-commit.fish
index 22e2b22..8b35b63 100755
--- a/functions/ia-commit.fish
+++ b/functions/ia-commit.fish
@@ -3,7 +3,7 @@
# Utility that will Prompt a LLM to make a commit message from a git diff.
function _ask
- echo "Is it correct ?! (y/n/e/1/r/)"
+ echo "Is it correct ?! (y/n/e/1/r)"
read response
if [ $response = y ]
@@ -14,16 +14,21 @@ function _ask
$EDITOR /tmp/prev-ia-commit-message
cat /tmp/prev-ia-commit-message | head -n 1
_ask
+ return $status
else if [ $response = r ]
ia-commit
else if [ $response = n ]
- exit 1
+ return 1
end
+
+ return 0
end
function ia-commit
echo -e "Write a professional git commit message based on the a diff below. \nDo not preface the commit with anything, use the present tense, return the full sentence, and use the conventional commits specification (<type in lowercase>: <subject>)\n\n-----\n\n$(git diff --staged)" | hailper -p b-code | tee /tmp/prev-ia-commit-message
_ask
+ set -l ret $status
rm /tmp/prev-ia-commit-message 2>/dev/null
+ return $ret
end