Browse Source

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.
pull/20/head
Xx 6 months ago
parent
commit
2e27634c8d
  1. 1
      .vscode/settings.json
  2. BIN
      app.exe
  3. 11
      app.manifest
  4. BIN
      cursor-id-modifier-linux
  5. BIN
      cursor-id-modifier-macos
  6. 12
      go.mod
  7. 15
      go.sum
  8. 9
      install.sh
  9. 11
      main.go

1
.vscode/settings.json

@ -9,6 +9,7 @@
"ldflags", "ldflags",
"LOCALAPPDATA", "LOCALAPPDATA",
"pkill", "pkill",
"runas",
"setlocal", "setlocal",
"taskkill", "taskkill",
"trimpath" "trimpath"

BIN
app.exe

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>

BIN
cursor-id-modifier-linux

BIN
cursor-id-modifier-macos

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 ( require (
github.com/mattn/go-colorable v0.1.13 // indirect 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

@ -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 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= 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.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.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=

9
install.sh

@ -16,15 +16,14 @@ detect_platform() {
case "$OS" in case "$OS" in
linux*) linux*)
case "$ARCH" in 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" ;; *) error "Unsupported Linux architecture/不支持的Linux架构: $ARCH" ;;
esac esac
;; ;;
darwin*) darwin*)
case "$ARCH" in 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" ;; *) error "Unsupported macOS architecture/不支持的macOS架构: $ARCH" ;;
esac esac
;; ;;
@ -47,7 +46,7 @@ INSTALL_DIR="/usr/local/bin"
# Download binary / 下载二进制文件 # Download binary / 下载二进制文件
echo "Downloading cursor-id-modifier for/正在下载 $OS ($ARCH)..." echo "Downloading cursor-id-modifier for/正在下载 $OS ($ARCH)..."
TEMP_DIR=$(mktemp -d) 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 if ! curl -fsSL "$DOWNLOAD_URL" -o "$TEMP_DIR/$BINARY_NAME"; then
error "Failed to download binary/下载二进制文件失败" error "Failed to download binary/下载二进制文件失败"

11
main.go

@ -15,7 +15,6 @@ import (
"path/filepath" "path/filepath"
"runtime" "runtime"
"strings" "strings"
"syscall"
"time" "time"
"github.com/fatih/color" "github.com/fatih/color"
@ -437,11 +436,11 @@ func selfElevate() error {
if err != nil { if err != nil {
return err 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 var showCmd int32 = 1 //SW_NORMAL

Loading…
Cancel
Save