From d08de3033198040812e03e1e683d53d6558d1212 Mon Sep 17 00:00:00 2001 From: "ellipsis-dev[bot]" <65095814+ellipsis-dev[bot]@users.noreply.github.com> Date: Tue, 14 May 2024 17:39:10 +0000 Subject: [PATCH 1/3] implement #2; --- src/commitm.zsh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) mode change 100755 => 100644 src/commitm.zsh diff --git a/src/commitm.zsh b/src/commitm.zsh old mode 100755 new mode 100644 index 469cbad..1e6008b --- a/src/commitm.zsh +++ b/src/commitm.zsh @@ -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() { @@ -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 @@ -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 @@ -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 From 21900ba8b26e77d92e354e16a271fc7c4c45dcf2 Mon Sep 17 00:00:00 2001 From: "ellipsis-dev[bot]" <65095814+ellipsis-dev[bot]@users.noreply.github.com> Date: Tue, 14 May 2024 18:15:30 +0000 Subject: [PATCH 2/3] address comments left by @marissamarym on #3 ([Ellipsis] Let the user modify the prompt); --- src/commitm.zsh | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/commitm.zsh b/src/commitm.zsh index 1e6008b..1e73590 100644 --- a/src/commitm.zsh +++ b/src/commitm.zsh @@ -145,11 +145,7 @@ commitm() { g) prompt_mod_description="More general";; esac - 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 + show_echo "\n$prompt_mod_description prompt: \e[1m\e[36m$(cat "$commit_message_temp_file")\e[0m\n" } # Generate the commit message with llm @@ -159,7 +155,7 @@ commitm() { local git_changes=$(cat "$git_output_temp_file") # Prepare the system prompt with modifications and git changes - local full_system_prompt="$system_prompt$prompt_mod" + local full_system_prompt="$system_prompt$prompt_mod$prompt" local git_changes_formatted="$git_changes" From 20fd9e5f520bb1fd7387d6d13993ae0c56f71922 Mon Sep 17 00:00:00 2001 From: "ellipsis-dev[bot]" <65095814+ellipsis-dev[bot]@users.noreply.github.com> Date: Tue, 14 May 2024 18:57:37 +0000 Subject: [PATCH 3/3] address comments left by @marissamarym on #3 ([Ellipsis] Let the user modify the prompt); --- src/commitm.zsh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/commitm.zsh b/src/commitm.zsh index 1e73590..0e6b010 100644 --- a/src/commitm.zsh +++ b/src/commitm.zsh @@ -155,7 +155,11 @@ commitm() { local git_changes=$(cat "$git_output_temp_file") # Prepare the system prompt with modifications and git changes - local full_system_prompt="$system_prompt$prompt_mod$prompt" +if [[ -n "$prompt" ]]; then + local full_system_prompt="$prompt$prompt_mod" +else + local full_system_prompt="$system_prompt$prompt_mod$prompt" +fi local git_changes_formatted="$git_changes"