Skip to content

Commit

Permalink
Use more commonly use version printing functions
Browse files Browse the repository at this point in the history
  • Loading branch information
doronbehar committed Apr 18, 2020
1 parent 25f5ce4 commit c8f5dc8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

NAME := pistol
VERSION := v0.1 (2020-04-17) (breaking release, see README)
version := $(word 1, $(VERSION))
VERSION := v0.1.1 (2020-04-17) (breaking release, see README)
# version := $(word 1, $(VERSION))

build:
go build -ldflags "-X 'main.VERSION=$(VERSION)'" ./cmd/pistol
go build -ldflags "-X 'main.Version=$(VERSION)'" ./cmd/pistol

install:
go install -ldflags "-X 'main.VERSION=$(VERSION)'" ./cmd/pistol
go install -ldflags "-X 'main.Version=$(VERSION)'" ./cmd/pistol

# requires: bat (https://github.com/sharkdp/bat), elinks
test: pistol
Expand Down
5 changes: 3 additions & 2 deletions cmd/pistol/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ package main
import (
"os"
"log"
"fmt"

"github.com/doronbehar/pistol"
"github.com/galdor/go-cmdline"
"github.com/adrg/xdg"
)

var (
VERSION string
Version string
)

func main() {
Expand All @@ -26,7 +27,7 @@ func main() {
cmd.Parse(os.Args)

if cmd.IsOptionSet("version") {
print(VERSION, "\n")
fmt.Println(Version)
os.Exit(0)
}

Expand Down

0 comments on commit c8f5dc8

Please sign in to comment.