diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 8f87b3f..284f2f8 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -15,6 +15,8 @@ builds: - arm64 env: - CGO_ENABLED=0 + ldflags: + - -s -w -X git.smsvc.net/pomodoro/ChronoTomato/cmd/client.version={{.Version}} upx: - enabled: true diff --git a/cmd/client/app.go b/cmd/client/app.go index 6a87b53..1607183 100644 --- a/cmd/client/app.go +++ b/cmd/client/app.go @@ -2,6 +2,8 @@ package client import ( "flag" + "fmt" + "os" "git.smsvc.net/pomodoro/ChronoTomato/internal/helper" "git.smsvc.net/pomodoro/ChronoTomato/internal/websocket" @@ -13,8 +15,9 @@ import ( ) var ( - config ChronoTomato.Config - client websocket.Client + version = "devel" + config ChronoTomato.Config + client websocket.Client ) type app struct { @@ -68,9 +71,15 @@ func Start() { parameter_url = flag.String("url", "", "GoTomato Server URL (eg ws://localhost:8080/ws)") parameter_password = flag.String("password", "", "Control password for pomodoro session") parameter_configfile = flag.String("config", defaultConfigFile, "Path to config file") + showVersion = flag.Bool("version", false, "Show Version") ) flag.Parse() + if *showVersion { + fmt.Println("ChronoTomato", version) + os.Exit(0) + } + // read passed config file or try to use default config if *parameter_configfile != defaultConfigFile { config = helper.ParseConfig(*parameter_configfile)