mirror of
https://git.sr.ht/~adnano/kiln
synced 2024-10-30 09:23:09 +00:00
Add -v flag to print version
This commit is contained in:
parent
1389d339ca
commit
580cc88e8a
3
Makefile
3
Makefile
|
@ -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
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 {
|
||||
|
|
Loading…
Reference in a new issue