Skip to content

Commit

Permalink
feat: show version
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfogre committed Aug 19, 2020
1 parent bd44d0c commit a58d680
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
18 changes: 18 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ builds:
- linux
- darwin
- windows
goarch:
- 386
- amd64
- arm
- arm64
ignore:
- goos: darwin
goarch: 386
checksum:
name_template: 'checksums.txt'
snapshot:
Expand All @@ -19,3 +27,13 @@ changelog:
exclude:
- '^docs:'
- '^test:'
brews:
-
github:
owner: wolfogre
name: homebrew-tap
folder: Formula
homepage: "https://github.com/wolfogre/gtag"
description: "Help you to get golang struct's tags elegantly."
test: system "#{bin}/gtag -version"
install: bin.install "gtag"
17 changes: 15 additions & 2 deletions cmd/gtag/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,26 @@ import (
)

var (
Types = flag.String("types", "", "struct types")
Tags = flag.String("tags", "", "preset tags")
version = "dev"
commit = "none"
date = "unknown"
builtBy = "unknown"
)

var (
Types = flag.String("types", "", "struct types")
Tags = flag.String("tags", "", "preset tags")
Version = flag.Bool("version", false, " show version")
)

func main() {
flag.Parse()

if *Version {
fmt.Printf("gtag %s, commit %s, built at %s by %s\n", version, commit, date, builtBy)
return
}

args := flag.Args()
if *Types == "" || len(args) != 1 {
printUsages()
Expand Down

0 comments on commit a58d680

Please sign in to comment.