mirror of
https://github.com/yuaotian/go-cursor-help.git
synced 2025-06-08 04:22:06 +08:00
feat: Remove obsolete binaries and update module dependencies
- Deleted outdated binary files for Windows, Linux, and macOS platforms to streamline the project. - Updated `go.mod` to change the module path to `cursor-id-modifier` and adjusted dependency versions for `github.com/fatih/color` and `golang.org/x/sys`. - Modified `install.sh` to reflect new binary naming conventions and download URLs. - Cleaned up whitespace in `main.go` for improved code readability. This commit focuses on cleaning up the project structure and ensuring dependencies are up-to-date.
This commit is contained in:
parent
394e144a2e
commit
2e27634c8d
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
@ -9,6 +9,7 @@
|
||||
"ldflags",
|
||||
"LOCALAPPDATA",
|
||||
"pkill",
|
||||
"runas",
|
||||
"setlocal",
|
||||
"taskkill",
|
||||
"trimpath"
|
||||
|
11
app.manifest
11
app.manifest
@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||
<assemblyIdentity version="1.0.0.0" processorArchitecture="*" name="app" type="win32"/>
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<security>
|
||||
<requestedPrivileges>
|
||||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
</assembly>
|
Binary file not shown.
Binary file not shown.
12
go.mod
12
go.mod
@ -1,11 +1,13 @@
|
||||
module github.com/yuaotian/go-cursor-help
|
||||
module cursor-id-modifier
|
||||
|
||||
go 1.22.0
|
||||
go 1.21
|
||||
|
||||
require github.com/fatih/color v1.18.0
|
||||
require (
|
||||
github.com/fatih/color v1.15.0
|
||||
golang.org/x/sys v0.13.0
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
golang.org/x/sys v0.28.0
|
||||
github.com/mattn/go-isatty v0.0.17 // indirect
|
||||
)
|
||||
|
15
go.sum
15
go.sum
@ -1,13 +1,10 @@
|
||||
github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM=
|
||||
github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU=
|
||||
github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs=
|
||||
github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw=
|
||||
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
|
||||
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
|
||||
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng=
|
||||
github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34=
|
||||
golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
|
||||
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
|
||||
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
|
@ -16,15 +16,14 @@ detect_platform() {
|
||||
case "$OS" in
|
||||
linux*)
|
||||
case "$ARCH" in
|
||||
x86_64) BINARY_NAME="cursor-id-modifier" ;;
|
||||
aarch64) BINARY_NAME="cursor-id-modifier-arm64" ;;
|
||||
x86_64) BINARY_NAME="cursor_id_modifier_v2.0.0_linux_amd64" ;;
|
||||
*) error "Unsupported Linux architecture/不支持的Linux架构: $ARCH" ;;
|
||||
esac
|
||||
;;
|
||||
darwin*)
|
||||
case "$ARCH" in
|
||||
x86_64) BINARY_NAME="cursor-id-modifier-amd64" ;;
|
||||
arm64) BINARY_NAME="cursor-id-modifier-arm64" ;;
|
||||
x86_64) BINARY_NAME="cursor_id_modifier_v2.0.0_mac_intel" ;;
|
||||
arm64) BINARY_NAME="cursor_id_modifier_v2.0.0_mac_m1" ;;
|
||||
*) error "Unsupported macOS architecture/不支持的macOS架构: $ARCH" ;;
|
||||
esac
|
||||
;;
|
||||
@ -47,7 +46,7 @@ INSTALL_DIR="/usr/local/bin"
|
||||
# Download binary / 下载二进制文件
|
||||
echo "Downloading cursor-id-modifier for/正在下载 $OS ($ARCH)..."
|
||||
TEMP_DIR=$(mktemp -d)
|
||||
DOWNLOAD_URL="https://github.com/yuaotian/go-cursor-help/releases/latest/download/$BINARY_NAME"
|
||||
DOWNLOAD_URL="https://github.com/yuaotian/go-cursor-help/raw/main/bin/$BINARY_NAME"
|
||||
|
||||
if ! curl -fsSL "$DOWNLOAD_URL" -o "$TEMP_DIR/$BINARY_NAME"; then
|
||||
error "Failed to download binary/下载二进制文件失败"
|
||||
|
71
main.go
71
main.go
@ -15,7 +15,6 @@ import (
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/fatih/color"
|
||||
@ -35,16 +34,16 @@ const (
|
||||
|
||||
// TextResource 存储多语言文本 / TextResource stores multilingual text
|
||||
type TextResource struct {
|
||||
SuccessMessage string
|
||||
RestartMessage string
|
||||
ReadingConfig string
|
||||
GeneratingIds string
|
||||
PressEnterToExit string
|
||||
ErrorPrefix string
|
||||
PrivilegeError string
|
||||
RunAsAdmin string
|
||||
RunWithSudo string
|
||||
SudoExample string
|
||||
SuccessMessage string
|
||||
RestartMessage string
|
||||
ReadingConfig string
|
||||
GeneratingIds string
|
||||
PressEnterToExit string
|
||||
ErrorPrefix string
|
||||
PrivilegeError string
|
||||
RunAsAdmin string
|
||||
RunWithSudo string
|
||||
SudoExample string
|
||||
}
|
||||
|
||||
// StorageConfig 优化的存储配置结构 / StorageConfig optimized storage configuration struct
|
||||
@ -76,28 +75,28 @@ var (
|
||||
|
||||
texts = map[Language]TextResource{
|
||||
CN: {
|
||||
SuccessMessage: "[√] 配置文件已成功更新!",
|
||||
RestartMessage: "[!] 请手动重启 Cursor 以使更新生效",
|
||||
ReadingConfig: "正在读取配置文件...",
|
||||
GeneratingIds: "正在生成新的标识符...",
|
||||
PressEnterToExit: "按回车键退出程序...",
|
||||
ErrorPrefix: "程序发生严重错误: %v",
|
||||
PrivilegeError: "\n[!] 错误:需要管理员权限",
|
||||
RunAsAdmin: "请右键点击程序,选择「以管理员身份运行」",
|
||||
RunWithSudo: "请使用 sudo 命令运行此程序",
|
||||
SudoExample: "示例: sudo %s",
|
||||
SuccessMessage: "[√] 配置文件已成功更新!",
|
||||
RestartMessage: "[!] 请手动重启 Cursor 以使更新生效",
|
||||
ReadingConfig: "正在读取配置文件...",
|
||||
GeneratingIds: "正在生成新的标识符...",
|
||||
PressEnterToExit: "按回车键退出程序...",
|
||||
ErrorPrefix: "程序发生严重错误: %v",
|
||||
PrivilegeError: "\n[!] 错误:需要管理员权限",
|
||||
RunAsAdmin: "请右键点击程序,选择「以管理员身份运行」",
|
||||
RunWithSudo: "请使用 sudo 命令运行此程序",
|
||||
SudoExample: "示例: sudo %s",
|
||||
},
|
||||
EN: {
|
||||
SuccessMessage: "[√] Configuration file updated successfully!",
|
||||
RestartMessage: "[!] Please restart Cursor manually for changes to take effect",
|
||||
ReadingConfig: "Reading configuration file...",
|
||||
GeneratingIds: "Generating new identifiers...",
|
||||
PressEnterToExit: "Press Enter to exit...",
|
||||
ErrorPrefix: "Program encountered a serious error: %v",
|
||||
PrivilegeError: "\n[!] Error: Administrator privileges required",
|
||||
RunAsAdmin: "Please right-click and select 'Run as Administrator'",
|
||||
RunWithSudo: "Please run this program with sudo",
|
||||
SudoExample: "Example: sudo %s",
|
||||
SuccessMessage: "[√] Configuration file updated successfully!",
|
||||
RestartMessage: "[!] Please restart Cursor manually for changes to take effect",
|
||||
ReadingConfig: "Reading configuration file...",
|
||||
GeneratingIds: "Generating new identifiers...",
|
||||
PressEnterToExit: "Press Enter to exit...",
|
||||
ErrorPrefix: "Program encountered a serious error: %v",
|
||||
PrivilegeError: "\n[!] Error: Administrator privileges required",
|
||||
RunAsAdmin: "Please right-click and select 'Run as Administrator'",
|
||||
RunWithSudo: "Please run this program with sudo",
|
||||
SudoExample: "Example: sudo %s",
|
||||
},
|
||||
}
|
||||
)
|
||||
@ -437,11 +436,11 @@ func selfElevate() error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
verbPtr, _ := syscall.UTF16PtrFromString(verb)
|
||||
exePtr, _ := syscall.UTF16PtrFromString(exe)
|
||||
cwdPtr, _ := syscall.UTF16PtrFromString(cwd)
|
||||
argPtr, _ := syscall.UTF16PtrFromString("")
|
||||
// 将字符串转换为UTF-16指针
|
||||
verbPtr, _ := windows.UTF16PtrFromString(verb)
|
||||
exePtr, _ := windows.UTF16PtrFromString(exe)
|
||||
cwdPtr, _ := windows.UTF16PtrFromString(cwd)
|
||||
argPtr, _ := windows.UTF16PtrFromString("")
|
||||
|
||||
var showCmd int32 = 1 //SW_NORMAL
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user