Skip to content

Commit

Permalink
feat: add MustNewXMLStyle
Browse files Browse the repository at this point in the history
  • Loading branch information
alecthomas committed Nov 2, 2022
1 parent c263f6f commit ebba701
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions style.go
Expand Up @@ -230,6 +230,15 @@ func NewXMLStyle(r io.Reader) (*Style, error) {
return style, dec.Decode(style)
}

// MustNewXMLStyle is like NewXMLStyle but panics on error.
func MustNewXMLStyle(r io.Reader) *Style {
style, err := NewXMLStyle(r)
if err != nil {
panic(err)
}
return style
}

// NewStyle creates a new style definition.
func NewStyle(name string, entries StyleEntries) (*Style, error) {
return NewStyleBuilder(name).AddAll(entries).Build()
Expand Down
2 changes: 1 addition & 1 deletion styles/api.go
@@ -1,7 +1,7 @@
package styles

import (
"embed" // Imported for side-effects.
"embed"
"io/fs"
"sort"

Expand Down

0 comments on commit ebba701

Please sign in to comment.