Skip to content

Commit

Permalink
Add support for spec 0.10.1
Browse files Browse the repository at this point in the history
  • Loading branch information
belak committed Jul 4, 2022
1 parent 79560ac commit 90f7f03
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
14 changes: 8 additions & 6 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ var (
log = logrus.NewEntry(rawLog)

// Variables set by goreleaser
version = "dev"
commit = "unknown"
date = "unknown"
version = "dev"
commit = "unknown"
date = "unknown"
specVersion = "0.10.1"
)

func init() {
Expand Down Expand Up @@ -72,9 +73,10 @@ func main() {
flag.Parse()

log.WithFields(logrus.Fields{
"version": version,
"commit": commit,
"date": date,
"version": version,
"commit": commit,
"date": date,
"spec-version": specVersion,
}).Info("base16-builder-go")

var targetFS fs.FS
Expand Down
18 changes: 12 additions & 6 deletions scheme.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ var bases = []string{
}

type scheme struct {
Name string `yaml:"-"`
Slug string `yaml:"-"`

Scheme string `yaml:"scheme"`
Author string `yaml:"author"`
Scheme string `yaml:"scheme"`
Author string `yaml:"author"`
Description string `yaml:"description"`

// Colors will hold all the "base*" variables.
Colors map[string]color `yaml:",inline"`
Expand Down Expand Up @@ -65,6 +65,11 @@ func schemeFromFile(schemesFS fs.FS, fileName string) (*scheme, bool) {
ok = false
}

// Sanitize any fields which were added later
if ret.Description == "" {
ret.Description = ret.Scheme
}

// Now that we've got all that out of the way, we can start
// processing stuff.

Expand All @@ -85,9 +90,10 @@ func schemeFromFile(schemesFS fs.FS, fileName string) (*scheme, bool) {

func (s *scheme) mustacheContext() map[string]interface{} {
ret := map[string]interface{}{
"scheme-name": s.Scheme,
"scheme-author": s.Author,
"scheme-slug": s.Slug,
"scheme-name": s.Scheme,
"scheme-author": s.Author,
"scheme-slug": s.Slug,
"scheme-description": s.Description,

// Any extensions on the spec should go here
"scheme-slug-underscored": strings.Replace(s.Slug, "-", "_", -1),
Expand Down

0 comments on commit 90f7f03

Please sign in to comment.