mirror of
https://github.com/prymitive/karma
synced 2026-05-07 03:26:52 +00:00
Add --version flag
This is useful to get the version from the compiled binary without the need to run it
This commit is contained in:
8
main.go
8
main.go
@@ -12,6 +12,7 @@ import (
|
||||
"github.com/cloudflare/unsee/internal/config"
|
||||
"github.com/cloudflare/unsee/internal/models"
|
||||
"github.com/cloudflare/unsee/internal/transform"
|
||||
"github.com/spf13/pflag"
|
||||
|
||||
"github.com/DeanThompson/ginpprof"
|
||||
"github.com/gin-contrib/gzip"
|
||||
@@ -109,6 +110,13 @@ func setupLogger() {
|
||||
}
|
||||
|
||||
func main() {
|
||||
printVersion := pflag.Bool("version", false, "Print version and exit")
|
||||
pflag.Parse()
|
||||
if *printVersion {
|
||||
fmt.Println(version)
|
||||
return
|
||||
}
|
||||
|
||||
config.Config.Read()
|
||||
setupLogger()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user