1
0
mirror of https://git.sr.ht/~adnano/kiln synced 2024-11-08 10:09:18 +01:00

Add -v flag to print version

This commit is contained in:
adnano 2021-04-12 00:31:55 -04:00
parent 1458f336b4
commit 413748e6e2
2 changed files with 14 additions and 4 deletions

@ -26,8 +26,7 @@ doc: $(DOCS)
kiln: $(GOSRC)
$(GO) build $(GOFLAGS) \
-ldflags "-X main.Prefix=$(PREFIX) \
-X main.Version=$(VERSION)" \
-ldflags "-X main.Version=$(VERSION)" \
-o $@
clean:

15
main.go

@ -11,16 +11,27 @@ import (
"strings"
)
var (
Version string
)
func main() {
var (
task string
config string
task string
config string
version bool
)
flag.StringVar(&task, "t", "all", "the task to run")
flag.StringVar(&config, "c", "config.toml", "the configuration file to use")
flag.BoolVar(&version, "v", false, "print version")
flag.Parse()
if version {
fmt.Println("kiln", Version)
return
}
// Load config
cfg, err := LoadConfig(config)
if err != nil {