Skip to content

Commit 61c37aa

Browse files
committed
fix: avoid duplicate configuration by checking for existing entries
- Prevent duplicate entries by skipping configuration if it already exists in the file - Add informational message when configuration is already present Signed-off-by: appleboy <[email protected]>
1 parent a13024b commit 61c37aa

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

install.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,11 @@ function add_to_path() {
8383
local config_file=$1
8484
local command=$2
8585

86+
if grep -Fxq "$command" "$config_file"; then
87+
print_message info "Configuration already exists in $config_file, skipping"
88+
return 0
89+
fi
90+
8691
if [[ -w $config_file ]]; then
8792
printf "\n# codegpt\n" >>"$config_file"
8893
echo "$command" >>"$config_file"

0 commit comments

Comments
 (0)