Skip to content

Commit

Permalink
Support version flag
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilturek committed Aug 26, 2022
1 parent e4180bc commit 56488d2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ before:
builds:
- main:
./cmd/go-zpl
ldflags:
- "-s -w -X github.com/kamilturek/go-zpl.version={{.Version}}"
env:
- CGO_ENABLED=0
goos:
Expand Down
10 changes: 10 additions & 0 deletions cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,24 @@ import (
"os"
)

var version string

func RunCLI() {
showVersion := flag.Bool("v", false, "version for go-zpl")
showVersionLong := flag.Bool("version", false, "version for go-zpl")

density := flag.Int("d", 8, "input label density [dpmm]")
width := flag.Int("w", 4, "input label width [inch]")
height := flag.Int("h", 6, "input label height [inch]")
outputPath := flag.String("o", "", "output file path")
outputFormat := flag.String("f", "png", "output file format")
flag.Parse()

if *showVersion || *showVersionLong {
fmt.Fprintln(os.Stdout, version)
os.Exit(0)
}

if err := Convert(
WithInputFromArgs(flag.Args()),
WithOutputPath(*outputPath),
Expand Down

0 comments on commit 56488d2

Please sign in to comment.