Skip to content

Commit

Permalink
implement #2;
Browse files Browse the repository at this point in the history
  • Loading branch information
ellipsis-dev[bot] authored May 14, 2024
1 parent 987851b commit d08de30
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/commitm.zsh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ show_help() {
echo " -np, --no-prefix Clear the prefix for the generated message."
echo " -q, --quiet Suppress all output."
echo " -v Show the current version."
echo " -pr, --prompt Set a custom prompt for the commit message."
}

show_version() {
Expand Down Expand Up @@ -43,6 +44,7 @@ commitm() {
local cleaned_up=false
local length_level=0
local is_bot_generated=true
local prompt=""

# Command line argument validation
local is_prefix_set=false
Expand All @@ -68,6 +70,12 @@ commitm() {
prev_arg=""
continue
fi
if [[ "$prev_arg" == "--prompt" ]] || [[ "$prev_arg" == "-pr" ]]; then
prompt="$arg"
# Reset prev_arg
prev_arg=""
continue
fi
prev_arg="$arg"

if [[ "$arg" == "--execute" ]] || [[ "$arg" == "-e" ]]; then
Expand Down Expand Up @@ -137,7 +145,11 @@ commitm() {
g) prompt_mod_description="More general";;
esac

show_echo "\n$prompt_mod_description prompt: \e[1m\e[36m$(cat "$commit_message_temp_file")\e[0m\n"
if [[ -n "$prompt" ]]; then
show_echo "\n$prompt prompt: \e[1m\e[36m$(cat "$commit_message_temp_file")\e[0m\n"
else
show_echo "\n$prompt_mod_description prompt: \e[1m\e[36m$(cat "$commit_message_temp_file")\e[0m\n"
fi
}

# Generate the commit message with llm
Expand Down

0 comments on commit d08de30

Please sign in to comment.