personal license added

This commit is contained in:
sqshq 2019-07-21 23:30:05 -04:00
parent bc51750141
commit 60b325eabf
2 changed files with 15 additions and 5 deletions

View File

@ -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 {

View File

@ -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 {