Private
Public Access
1
0
This commit is contained in:
2025-12-12 13:59:42 +08:00
parent edd8ce3245
commit 9fee340a85
3 changed files with 28 additions and 28 deletions

View File

@@ -125,7 +125,7 @@ create_settings_file() {
local api_key="$2" local api_key="$2"
# Write to .env file # Write to .env file
cat <<EOF > "$GEMINI_ENV_FILE" cat <<EOF >"$GEMINI_ENV_FILE"
GOOGLE_GEMINI_BASE_URL="$base_url" GOOGLE_GEMINI_BASE_URL="$base_url"
GEMINI_API_KEY="$api_key" GEMINI_API_KEY="$api_key"
GEMINI_MODEL="gemini-3-pro-preview" GEMINI_MODEL="gemini-3-pro-preview"
@@ -134,7 +134,7 @@ EOF
# Write to settings.json # Write to settings.json
local settings_json_path="$GEMINI_CONFIG_DIR/settings.json" local settings_json_path="$GEMINI_CONFIG_DIR/settings.json"
cat <<EOF > "$settings_json_path" cat <<EOF >"$settings_json_path"
{ {
"general": { "general": {
"previewFeatures": true "previewFeatures": true
@@ -179,19 +179,19 @@ main() {
while [[ $# -gt 0 ]]; do while [[ $# -gt 0 ]]; do
case $1 in case $1 in
-k|--key) -k | --key)
api_key="$2" api_key="$2"
shift 2 shift 2
;; ;;
-t|--test) -t | --test)
test_only=true test_only=true
shift shift
;; ;;
-s|--show) -s | --show)
show_settings=true show_settings=true
shift shift
;; ;;
-h|--help) -h | --help)
cat <<EOF cat <<EOF
Usage: $0 [OPTIONS] Usage: $0 [OPTIONS]

View File

@@ -58,7 +58,7 @@ write_env_to_shell() {
# 确保文件末尾有换行 # 确保文件末尾有换行
if [ -s "$rc_file" ] && [ "$(tail -c1 "$rc_file" | wc -l)" -eq 0 ]; then if [ -s "$rc_file" ] && [ "$(tail -c1 "$rc_file" | wc -l)" -eq 0 ]; then
echo "" >> "$rc_file" echo "" >>"$rc_file"
fi fi
# 转义特殊字符(使用单引号包裹更安全) # 转义特殊字符(使用单引号包裹更安全)
@@ -73,12 +73,12 @@ write_env_to_shell() {
local tmp_file local tmp_file
tmp_file=$(mktemp) tmp_file=$(mktemp)
if [ -s "$rc_file" ]; then if [ -s "$rc_file" ]; then
grep -v "^export $var_name=" "$rc_file" | grep -v "^set -Ux $var_name " > "$tmp_file" 2>/dev/null || true grep -v "^export $var_name=" "$rc_file" | grep -v "^set -Ux $var_name " >"$tmp_file" 2>/dev/null || true
fi fi
echo "$export_line" >> "$tmp_file" echo "$export_line" >>"$tmp_file"
# 保留原文件权限 # 保留原文件权限
cat "$tmp_file" > "$rc_file" cat "$tmp_file" >"$rc_file"
rm -f "$tmp_file" rm -f "$tmp_file"
# 立即生效 # 立即生效

View File

@@ -163,7 +163,7 @@ create_settings() {
# Write config.json for VSCode Claude extension # Write config.json for VSCode Claude extension
local config_json_path="$CLAUDE_CONFIG_DIR/config.json" local config_json_path="$CLAUDE_CONFIG_DIR/config.json"
cat <<EOF > "$config_json_path" cat <<EOF >"$config_json_path"
{ {
"primaryApiKey": "xcodecli" "primaryApiKey": "xcodecli"
} }