diff --git a/.goreleaser.yml b/.goreleaser.yml index 517123f..55cf728 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -6,36 +6,39 @@ before: builds: - id: git-get - main: ./cmd/get/main.go + main: ./cmd/ binary: git-get ldflags: - -s -w - -X git-get/pkg/cfg.version={{.Version}} - - -X git-get/pkg/cfg.commit={{.Commit}} - - -X git-get/pkg/cfg.date={{.Date}} + - -X git-get/pkg/cfg.commit={{.Commit}} goos: - linux - - darwin - windows - - id: git-list - main: ./cmd/list/main.go - binary: git-list + goarch: + - amd64 + - arm64 + - arm + goarm: + - 7 + - id: git-get-macos + main: ./cmd/ + binary: git-get ldflags: - -s -w - -X git-get/pkg/cfg.version={{.Version}} - - -X git-get/pkg/cfg.commit={{.Commit}} - - -X git-get/pkg/cfg.date={{.Date}} + - -X git-get/pkg/cfg.commit={{.Commit}} goos: - - linux - darwin - - windows + goarch: + - amd64 + - arm64 archives: - id: archive ids: - git-get - - git-list - name_template: "git-get_{{ .Version }}_{{ .Os }}_{{ .Arch }}" + name_template: "git-get_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{- if .Arm }}v{{ .Arm }}{{ end }}{{- if .Amd64 }}v{{ .Amd64 }}{{ end }}" formats: - tar.gz - zip @@ -43,6 +46,14 @@ archives: - goos: windows formats: [zip] # Don't include any additional files into the archives (such as README, CHANGELOG etc). + files: + - none* + - id: macos-archive + ids: + - git-get-macos + name_template: "git-get_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{- if .Arm }}v{{ .Arm }}{{ end }}{{- if .Amd64 }}v{{ .Amd64 }}{{ end }}" + formats: + - tar.gz files: - none* @@ -64,8 +75,10 @@ release: owner: grdl name: git-get -brews: +homebrew_casks: - name: git-get + ids: + - macos-archive repository: owner: grdl name: homebrew-tap @@ -73,13 +86,14 @@ brews: commit_author: name: Grzegorz Dlugoszewski email: git-get@grdl.dev - directory: Formula homepage: https://github.com/grdl/git-get/ description: Better way to clone, organize and manage multiple git repositories - test: | - system "git-get --version" - install: | - bin.install "git-get", "git-list" + url: + verified: github.com/grdl/git-get + hooks: + post: + install: | + system_command "/bin/ln", args: ["-sf", "#{staged_path}/git-get", "#{HOMEBREW_PREFIX}/bin/git-list"] nfpms: - id: packages @@ -94,6 +108,9 @@ nfpms: formats: - deb - rpm + scripts: + postinstall: "scripts/postinstall.sh" + preremove: "scripts/preremove.sh" scoops: - name: git-get @@ -110,3 +127,6 @@ scoops: homepage: "https://github.com/grdl/git-get" description: "Better way to clone, organize and manage multiple git repositories" license: MIT + post_install: [ + "New-Item -ItemType HardLink -Path \"$dir\\git-list.exe\" -Target \"$dir\\git-get.exe\" -Force | Out-Null" + ] diff --git a/README.md b/README.md index 5d871f2..ddfecb1 100644 --- a/README.md +++ b/README.md @@ -37,10 +37,12 @@ A tool to clone, organize, and manage multiple Git repositories with an automati **git-get** solves the problem of manually organizing multiple Git repositories. Instead of scattered clones in random directories, it creates a clean, predictable directory structure based on repository URLs, similar to Go's `go get` command. -It provides two commands: -- **`git get`** - Clones repositories into an organized directory tree +It provides two commands through a single binary: +- **`git get`** - Clones repositories into an organized directory tree - **`git list`** - Shows the status of all your repositories at a glance +*Note: Both commands are provided by a single `git-get` binary that automatically detects how it was invoked (either directly or via symlink).* + ![Example](./docs/example.svg) ## Features @@ -56,51 +58,91 @@ It provides two commands: ## Prerequisites - Git 2.0+ installed and configured -- Go 1.19+ (only if building from source) +- Go 1.24+ (only if building from source) ## Installation ### macOS +**Option 1: Homebrew (Recommended)** ```bash brew install grdl/tap/git-get ``` +*This automatically installs both `git-get` and `git-list` commands.* + +**Option 2: Manual Installation** +1. Download the latest macOS `.tar.gz` file from [releases](https://github.com/grdl/git-get/releases/latest) +2. Extract and install: + ```bash + tar -xzf git-get_*_darwin_*.tar.gz + sudo mv git-get /usr/local/bin/ + sudo ln -sf /usr/local/bin/git-get /usr/local/bin/git-list + ``` ### Linux -**Option 1: Package managers** +**Option 1: Package Managers (Recommended)** ```bash -# Download .deb or .rpm from releases -wget https://github.com/grdl/git-get/releases/latest/download/git-get_linux_amd64.deb -sudo dpkg -i git-get_linux_amd64.deb +# Ubuntu/Debian - Download and install .deb package +wget https://github.com/grdl/git-get/releases/latest/download/git-get_*_linux_amd64.deb +sudo dpkg -i git-get_*_linux_amd64.deb + +# CentOS/RHEL/Fedora - Download and install .rpm package +wget https://github.com/grdl/git-get/releases/latest/download/git-get_*_linux_amd64.rpm +sudo rpm -i git-get_*_linux_amd64.rpm +``` +*Package installation automatically creates the `git-list` symlink.* + +**Option 2: Manual Installation** +```bash +# Download and extract +wget https://github.com/grdl/git-get/releases/latest/download/git-get_*_linux_amd64.tar.gz +tar -xzf git-get_*_linux_amd64.tar.gz + +# Install binary and create symlink +sudo mv git-get /usr/local/bin/ +sudo ln -sf /usr/local/bin/git-get /usr/local/bin/git-list ``` -**Option 2: Homebrew on Linux** +**Option 3: Homebrew on Linux** ```bash brew install grdl/tap/git-get ``` ### Windows -**Option 1: Download binary** -1. Download the latest `.zip` file from [releases](https://github.com/grdl/git-get/releases/latest) -2. Extract the binaries to a directory in your PATH - -**Option 2: Using Scoop** +**Option 1: Scoop (Recommended)** ```powershell -scoop bucket add git-get https://github.com/grdl/git-get +scoop bucket add grdl https://github.com/grdl/git-get scoop install git-get ``` +*This automatically creates both `git-get.exe` and `git-list.exe` commands.* + +**Option 2: Manual Installation** +1. Download the latest Windows `.zip` file from [releases](https://github.com/grdl/git-get/releases/latest) +2. Extract `git-get.exe` to a directory in your PATH +3. Create a copy or hard link for `git-list`: + ```powershell + # In the same directory as git-get.exe + Copy-Item git-get.exe git-list.exe + # OR create a hard link (requires admin privileges) + New-Item -ItemType HardLink -Path "git-list.exe" -Target "git-get.exe" + ``` ### Building from Source ```bash git clone https://github.com/grdl/git-get.git cd git-get -go build -o bin/ ./cmd/... +go build -o git-get ./cmd/ + +# Create symlink for git-list +ln -sf git-get git-list # Unix/Linux/macOS +# OR +copy git-get.exe git-list.exe # Windows ``` -Then add the `bin/` directory to your PATH. +**Note:** The single binary (`git-get`) automatically detects how it's invoked and behaves as either `git-get` or `git-list` accordingly. ## Quick Start diff --git a/scripts/postinstall.sh b/scripts/postinstall.sh new file mode 100755 index 0000000..5af3cdf --- /dev/null +++ b/scripts/postinstall.sh @@ -0,0 +1,3 @@ +#!/bin/sh +# Create symlink for git-list command +ln -sf /usr/local/bin/git-get /usr/local/bin/git-list \ No newline at end of file diff --git a/scripts/preremove.sh b/scripts/preremove.sh new file mode 100755 index 0000000..b013566 --- /dev/null +++ b/scripts/preremove.sh @@ -0,0 +1,3 @@ +#!/bin/sh +# Remove symlink for git-list command +rm -f /usr/local/bin/git-list \ No newline at end of file