File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33
44VERSION=$( git describe --tags --dirty)
55GO_BUILD_CMD=" go build -a -installsuffix cgo"
6- GO_BUILD_LDFLAGS=" -s -w"
6+ GO_BUILD_LDFLAGS=" -s -w -X main.version= $VERSION "
77
88BUILD_PLATFORMS=" linux darwin"
99BUILD_ARCHS=" amd64"
Original file line number Diff line number Diff line change @@ -4,11 +4,26 @@ import (
44 "github.com/go-yaml/yaml"
55
66 "encoding/json"
7+ "flag"
78 "fmt"
89 "log"
10+ "os"
11+ )
12+
13+ var (
14+ showVersion = flag .Bool ("version" , false , "show version and exit" )
15+ url = "https://github.com/wakeful/yaml2json"
16+ version = "dev"
917)
1018
1119func main () {
20+ flag .Parse ()
21+
22+ if * showVersion {
23+ fmt .Printf ("yaml2json\n url: %s\n version: %s\n " , url , version )
24+ os .Exit (2 )
25+ }
26+
1227 input , err := readInput ()
1328
1429 if err != nil {
You can’t perform that action at this time.
0 commit comments