diff --git a/component/statusbar.go b/component/statusbar.go index 38fcac4..c77eff5 100644 --- a/component/statusbar.go +++ b/component/statusbar.go @@ -26,8 +26,10 @@ func NewStatusLine(configFileName string, palette console.Palette, license *meta block.Border = false text := fmt.Sprintf(" %s %s | ", console.AppTitle, console.AppVersion) - if license == nil || !license.Valid { + if license == nil || !license.Valid || license.Type == nil { text += console.AppLicenseWarning + } else if *license.Type == metadata.TypePersonal { + text += fmt.Sprintf("%s | personal license: %s", configFileName, *license.Username) } else if license.Username != nil { text += fmt.Sprintf("%s | licensed to %s", configFileName, *license.Username) if license.Company != nil { diff --git a/metadata/license.go b/metadata/license.go index 1fee655..a4d62e8 100644 --- a/metadata/license.go +++ b/metadata/license.go @@ -6,12 +6,20 @@ import ( ) type License struct { - Key *string `yaml:"k"` - Username *string `yaml:"u"` - Company *string `yaml:"c"` - Valid bool `yaml:"v"` + Key *string `yaml:"k"` + Username *string `yaml:"u"` + Company *string `yaml:"c"` + Type *LicenseType `yaml:"t"` + Valid bool `yaml:"v"` } +type LicenseType rune + +const ( + TypePersonal LicenseType = 0 + TypeCommercial LicenseType = 1 +) + const licenseFileName = "license.yml" func GetLicense() *License {