Browse Source

feat: Enhance installation script and improve user feedback

- Corrected character encoding issues in binary verification messages in `install.sh`.
- Updated download progress display and error handling for binary downloads.
- Added a new configuration location message in `main.go` for better user guidance.
- Removed obsolete binary files from releases to streamline the project structure.

These changes improve the reliability of the installation process and enhance user experience with clearer feedback and updated messaging.
pull/20/head
Xx 6 months ago
parent
commit
9237f883c9
  1. BIN
      bin/cursor_id_modifier_v2.0.0_darwin_amd64_intel
  2. BIN
      bin/cursor_id_modifier_v2.0.0_darwin_arm64_m1
  3. BIN
      bin/cursor_id_modifier_v2.0.0_linux_amd64
  4. BIN
      bin/cursor_id_modifier_v2.0.0_windows_amd64.exe
  5. 21
      install.sh
  6. 11
      main.go
  7. BIN
      releases/linux/cursor-id-modifier
  8. BIN
      releases/macos/cursor-id-modifier-amd64
  9. BIN
      releases/macos/cursor-id-modifier-arm64
  10. BIN
      releases/v1.0.1/releases/v1.0.1/cursor-id-modifier
  11. BIN
      releases/v1.0.1/releases/v1.0.1/cursor-id-modifier-amd64
  12. BIN
      releases/v1.0.1/releases/v1.0.1/cursor-id-modifier-arm64
  13. BIN
      releases/v1.0.1/releases/v1.0.1/cursor-id-modifier.exe

BIN
bin/cursor_id_modifier_v2.0.0_darwin_amd64_intel

BIN
bin/cursor_id_modifier_v2.0.0_darwin_arm64_m1

BIN
bin/cursor_id_modifier_v2.0.0_linux_amd64

BIN
bin/cursor_id_modifier_v2.0.0_windows_amd64.exe

21
install.sh

@ -76,7 +76,7 @@ check_requirements() {
# Verify binary / 验证二进制文件
verify_binary() {
info "Verifying binary..." "正在验证二���制文件..."
info "Verifying binary..." "正在验证二制文件..."
if [ ! -f "$TEMP_DIR/$BINARY_NAME" ]; then
error "Binary file download failed or does not exist" \
"二进制文件下载失败或不存在"
@ -122,16 +122,21 @@ main() {
info "Downloading cursor-id-modifier ($OS-$ARCH)..." \
"正在下载 cursor-id-modifier ($OS-$ARCH)..."
# 修改下载 URL,使用正确的仓库分支和文件路径
# 使用正确的 URL 格式
DOWNLOAD_URL="https://github.com/yuaotian/go-cursor-help/raw/refs/heads/master/bin/$BINARY_NAME"
# 使用 curl 显示详细的下载进度信息
if ! curl -L --progress-bar \
"$DOWNLOAD_URL" -o "$TEMP_DIR/$BINARY_NAME" 2>/dev/null; then
error "Failed to download binary from: $DOWNLOAD_URL (HTTP Status: $?)" \
"从以下地址下载二进制文件失败:$DOWNLOAD_URL (HTTP状态码: $?)"
info "Temporary file will be saved to: $TEMP_DIR" \
"临时文件将保存到:$TEMP_DIR"
# 使用 curl 显示下载进度
if ! curl -L --progress-bar "$DOWNLOAD_URL" -o "$TEMP_DIR/$BINARY_NAME"; then
error "Failed to download binary from: $DOWNLOAD_URL" \
"从以下地址下载二进制文件失败:$DOWNLOAD_URL"
fi
success "Download completed to: $TEMP_DIR/$BINARY_NAME" \
"下载完成,文件位置:$TEMP_DIR/$BINARY_NAME"
# Verify download / 验证下载
verify_binary
@ -161,7 +166,7 @@ main() {
cleanup_old_version() {
if [ -f "$INSTALL_DIR/cursor-id-modifier" ]; then
info "Removing old version..." "正在删除旧版..."
info "Removing old version..." "正在删除旧版..."
rm -f "$INSTALL_DIR/cursor-id-modifier" || \
error "Failed to remove old version" "删除旧版本失败"
fi

11
main.go

@ -51,6 +51,7 @@ type TextResource struct {
RunAsAdmin string
RunWithSudo string
SudoExample string
ConfigLocation string
}
// StorageConfig 优化的存储配置结构 / StorageConfig optimized storage configuration struct
@ -102,6 +103,7 @@ var (
RunAsAdmin: "请右键点击程序,选择「以管理员身份运行」",
RunWithSudo: "请使用 sudo 命令运行此程序",
SudoExample: "示例: sudo %s",
ConfigLocation: "配置文件位置:",
},
EN: {
SuccessMessage: "[√] Configuration file updated successfully!",
@ -114,6 +116,7 @@ var (
RunAsAdmin: "Please right-click and select 'Run as Administrator'",
RunWithSudo: "Please run this program with sudo",
SudoExample: "Example: sudo %s",
ConfigLocation: "Config file location:",
},
}
)
@ -350,9 +353,15 @@ func showSuccess() {
text := texts[currentLanguage]
successColor := color.New(color.FgGreen, color.Bold)
warningColor := color.New(color.FgYellow, color.Bold)
pathColor := color.New(color.FgCyan)
successColor.Printf("\n%s\n", text.SuccessMessage)
warningColor.Printf("%s\n", text.RestartMessage)
// 获取并输出配置文件路径
if configPath, err := getConfigPath(); err == nil {
pathColor.Printf("\n配置文件位置/Config file location:\n%s\n", configPath)
}
}
func showPrivilegeError() {
@ -668,7 +677,7 @@ func initConfig() *Config {
}
}
// UI 组件���化
// UI 组件
type UI struct {
config *UIConfig
spinner *ProgressSpinner

BIN
releases/linux/cursor-id-modifier

BIN
releases/macos/cursor-id-modifier-amd64

BIN
releases/macos/cursor-id-modifier-arm64

BIN
releases/v1.0.1/releases/v1.0.1/cursor-id-modifier

BIN
releases/v1.0.1/releases/v1.0.1/cursor-id-modifier-amd64

BIN
releases/v1.0.1/releases/v1.0.1/cursor-id-modifier-arm64

BIN
releases/v1.0.1/releases/v1.0.1/cursor-id-modifier.exe

Loading…
Cancel
Save