Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
BINARY_NAME := brew-sync
GO := go
GOFLAGS :=
LDFLAGS :=

# Version info injected at build time
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null || echo unknown)
LDFLAGS := -X brew-sync/cmd.Version=$(VERSION) -X brew-sync/cmd.Commit=$(COMMIT)

# Build output directory
BUILD_DIR := build
Expand Down
11 changes: 9 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ import (
"github.com/spf13/cobra"
)

// Version info set via ldflags at build time.
var (
Version = "dev"
Commit = "unknown"
)

var (
// Global flag values accessible by subcommands.
cfgFile string
Expand Down Expand Up @@ -107,8 +113,9 @@ func getUpdatedBy() string {
}

var rootCmd = &cobra.Command{
Use: "brew-sync",
Short: "Synchronize Homebrew packages across machines",
Use: "brew-sync",
Short: "Synchronize Homebrew packages across machines",
Version: Version + " (" + Commit + ")",
Long: `brew-sync is a CLI tool that wraps Homebrew to synchronize installed
packages (formulae and casks) across multiple machines.

Expand Down
Loading