diff --git a/Makefile b/Makefile index 0c68fdd..bc62a08 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ build: GOOS ?= darwin build: GOARCH ?= amd64 build: rm -f kt - GOOS=${GOOS} GOARCH=${GOARCH} go build . + GOOS=${GOOS} GOARCH=${GOARCH} go build -ldflags "-X main.buildTime=`date --iso-8601=s` -X main.buildVersion=`git rev-parse HEAD | cut -c-7`" . release-linux: GOOS=linux $(MAKE) build diff --git a/main.go b/main.go index 3a89eb3..812469e 100644 --- a/main.go +++ b/main.go @@ -8,6 +8,8 @@ import ( "os/signal" ) +var buildVersion, buildTime string + var config struct { consume consumeConfig produce produceConfig @@ -33,7 +35,7 @@ type command struct { run func(chan struct{}) } -var usageMessage = `kt is a tool for Kafka. +var usageMessage = fmt.Sprintf(`kt is a tool for Kafka. Usage: @@ -47,7 +49,8 @@ The commands are: Use "kt [command] -help" for for information about the command. -` +More at https://github.com/fgeller/kt +Build %v from %v.`, buildVersion, buildTime) func usage() { fmt.Fprintln(os.Stderr, usageMessage)