Skip to content

YHYJ/curator

Repository files navigation

Curator


Go build and release by GoReleaser


Table of Contents



用于克隆指定用户的指定仓库,支持 Linux 和 macOS

Install

一键安装

curl -fsSL https://raw.githubusercontent.com/YHYJ/curator/main/install.sh | sudo bash -s

Usage

  • config子命令

    该子命令用于操作配置文件,有以下参数:

    • 'create':创建默认内容的配置文件,可以使用全局参数'--config'指定配置文件路径
    • 'force':当指定的配置文件已存在时,使用该参数强制覆盖原文件
    • 'print':打印配置文件内容
  • clone子命令

    使用该子命令进行克隆,有以下参数:

    • '--source':指定使用的仓库源,目前支持 github.com 和 git.yj1516.top
  • pull子命令

    使用该子命令拉取远端仓库最新修改,有以下参数:

    • '--source':指定使用的仓库源,目前支持 github.com 和 git.yj1516.top
  • version子命令

    查看程序版本信息

  • help子命令

    查看程序帮助信息

Compile

当前平台

go build -gcflags="-trimpath" -ldflags="-s -w -X github.com/yhyj/curator/general.GitCommitHash=`git rev-parse HEAD` -X github.com/yhyj/curator/general.BuildTime=`date +%s` -X github.com/yhyj/curator/general.BuildBy=$USER" -o build/curator main.go

交叉编译

使用命令go tool dist list查看支持的平台

Linux

CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -gcflags="-trimpath" -ldflags="-s -w -X github.com/yhyj/curator/general.GitCommitHash=`git rev-parse HEAD` -X github.com/yhyj/curator/general.BuildTime=`date +%s` -X github.com/yhyj/curator/general.BuildBy=$USER" -o build/curator main.go

使用uname -m确定硬件架构

  • 结果是 x86_64 则 GOARCH=amd64
  • 结果是 aarch64 则 GOARCH=arm64

macOS

CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build -gcflags="-trimpath" -ldflags="-s -w -X github.com/yhyj/curator/general.GitCommitHash=`git rev-parse HEAD` -X github.com/yhyj/curator/general.BuildTime=`date +%s` -X github.com/yhyj/curator/general.BuildBy=$USER" -o build/curator main.go

使用uname -m确定硬件架构

  • 结果是 x86_64 则 GOARCH=amd64
  • 结果是 aarch64 则 GOARCH=arm64