From 761e38fd8ef64235da3f0614a615c2ea75056ba7 Mon Sep 17 00:00:00 2001 From: Ryan Cavicchioni Date: Sat, 13 Feb 2021 18:42:47 -0600 Subject: [PATCH] Add version to user agent --- cmd/main.go | 14 +++++++++++++- cmd/version.go | 3 +++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 cmd/version.go diff --git a/cmd/main.go b/cmd/main.go index 1cb2eef..996d6b5 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -6,14 +6,17 @@ import ( "fmt" "os" "path" + "strings" lifx "git.kill0.net/chill9/lume" "github.com/BurntSushi/toml" ) -const userAgent = "lume" +var userAgent string func init() { + userAgent = initUserAgent() + RegisterCommand("help", Command{ Func: HelpCmd, Flags: func() *flag.FlagSet { @@ -274,3 +277,12 @@ func getConfigPath() string { return configPath } + +func initUserAgent() string { + var b strings.Builder + + b.WriteString("lume") + b.WriteRune('/') + b.WriteString(Version) + return b.String() +} diff --git a/cmd/version.go b/cmd/version.go new file mode 100644 index 0000000..c508882 --- /dev/null +++ b/cmd/version.go @@ -0,0 +1,3 @@ +package lumecmd + +const Version = "0.1.0"