0
0
mirror of https://github.com/thegeeklab/git-sv.git synced 2024-11-24 01:00:39 +00:00

feat: add version on command usage

This commit is contained in:
Beatriz Vieira 2019-12-04 20:18:38 -03:00
parent c834806367
commit 0deb04cc9c
2 changed files with 7 additions and 1 deletions

View File

@ -10,10 +10,12 @@ BIN = git-sv
ECHOFLAGS ?= ECHOFLAGS ?=
VERSION ?=
BUILDOS ?= linux BUILDOS ?= linux
BUILDARCH ?= amd64 BUILDARCH ?= amd64
BUILDENVS ?= CGO_ENABLED=0 GOOS=$(BUILDOS) GOARCH=$(BUILDARCH) BUILDENVS ?= CGO_ENABLED=0 GOOS=$(BUILDOS) GOARCH=$(BUILDARCH)
BUILDFLAGS ?= -a -installsuffix cgo --ldflags '-extldflags "-lm -lstdc++ -static"' BUILDFLAGS ?= -a -installsuffix cgo --ldflags '-X main.Version=$(VERSION) -extldflags "-lm -lstdc++ -static"'
usage: Makefile usage: Makefile
@echo $(ECHOFLAGS) "to use make call:" @echo $(ECHOFLAGS) "to use make call:"

View File

@ -8,6 +8,9 @@ import (
"github.com/urfave/cli" "github.com/urfave/cli"
) )
// Version for git-sv
var Version = ""
func main() { func main() {
cfg := loadConfig() cfg := loadConfig()
@ -17,6 +20,7 @@ func main() {
app := cli.NewApp() app := cli.NewApp()
app.Name = "sv" app.Name = "sv"
app.Version = Version
app.Usage = "semantic version for git" app.Usage = "semantic version for git"
app.Commands = []cli.Command{ app.Commands = []cli.Command{
{ {