Skip to content
This repository was archived by the owner on Nov 26, 2023. It is now read-only.

Commit 34b0a61

Browse files
authored
Merge pull request #22 from tkms0106/5_version
add a --version command line argument
2 parents 3d6a104 + 2c3a172 commit 34b0a61

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
all:
22
mkdir -p dist
3-
gox -ldflags="-s -w" -tags="full" -osarch="darwin/amd64 linux/386 linux/amd64 linux/arm freebsd/amd64 windows/amd64" -output="dist/jiq_{{.OS}}_{{.Arch}}" github.com/fiatjaf/jiq/cmd/jiq
3+
gox -ldflags="-s -w -X main.version=$(shell git describe --tags)" -tags="full" -osarch="darwin/amd64 linux/386 linux/amd64 linux/arm freebsd/amd64 windows/amd64" -output="dist/jiq_{{.OS}}_{{.Arch}}" github.com/fiatjaf/jiq/cmd/jiq

cmd/jiq/jiq.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,15 @@ import (
77
"github.com/fiatjaf/jiq"
88
)
99

10+
var version string
11+
1012
func main() {
1113
content := os.Stdin
1214

15+
if len(os.Args) > 1 && os.Args[1] == "--version" {
16+
fmt.Println(version)
17+
os.Exit(0)
18+
}
1319
if len(os.Args) > 1 && os.Args[1] == "--help" {
1420
fmt.Print(`jiq - interactive commandline JSON processor
1521
Usage: <json string> | jiq [options] [initial filter]

0 commit comments

Comments
 (0)