mirror of
https://github.com/yuaotian/go-cursor-help.git
synced 2025-08-02 22:07:36 +08:00
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.
This commit is contained in:
parent
53be4b55fd
commit
9237f883c9
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
21
install.sh
21
install.sh
@ -76,7 +76,7 @@ check_requirements() {
|
||||
|
||||
# Verify binary / 验证二进制文件
|
||||
verify_binary() {
|
||||
info "Verifying binary..." "正在验证二<EFBFBD><EFBFBD><EFBFBD>制文件..."
|
||||
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
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 组件<EFBFBD><EFBFBD><EFBFBD>化
|
||||
// UI 组件
|
||||
type UI struct {
|
||||
config *UIConfig
|
||||
spinner *ProgressSpinner
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user