Add version to user agent

This commit is contained in:
Ryan Cavicchioni 2021-02-13 18:42:47 -06:00
parent e0a658edf7
commit 761e38fd8e
Signed by: ryanc
GPG Key ID: 877EEDAF9245103D
2 changed files with 16 additions and 1 deletions

View File

@ -6,14 +6,17 @@ import (
"fmt" "fmt"
"os" "os"
"path" "path"
"strings"
lifx "git.kill0.net/chill9/lume" lifx "git.kill0.net/chill9/lume"
"github.com/BurntSushi/toml" "github.com/BurntSushi/toml"
) )
const userAgent = "lume" var userAgent string
func init() { func init() {
userAgent = initUserAgent()
RegisterCommand("help", Command{ RegisterCommand("help", Command{
Func: HelpCmd, Func: HelpCmd,
Flags: func() *flag.FlagSet { Flags: func() *flag.FlagSet {
@ -274,3 +277,12 @@ func getConfigPath() string {
return configPath return configPath
} }
func initUserAgent() string {
var b strings.Builder
b.WriteString("lume")
b.WriteRune('/')
b.WriteString(Version)
return b.String()
}

3
cmd/version.go Normal file
View File

@ -0,0 +1,3 @@
package lumecmd
const Version = "0.1.0"