Add utility functions for filtering results and rename templates
This commit is contained in:
parent
66e63c66a1
commit
600bafe08d
@ -1,6 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"text/template"
|
||||
)
|
||||
|
||||
@ -42,6 +43,16 @@ type SummaryRowData struct {
|
||||
Info string
|
||||
}
|
||||
|
||||
// utility functions to allow filtering of results in the template
|
||||
|
||||
func (r SummaryRowData) NameHasPrefix(prefix string) bool {
|
||||
return strings.HasPrefix(r.Name, prefix)
|
||||
}
|
||||
|
||||
func (r SummaryRowData) NameContains(prefix string) bool {
|
||||
return strings.Contains(r.Name, prefix)
|
||||
}
|
||||
|
||||
type TemplateSummary struct {
|
||||
ServerName string
|
||||
Raw string
|
||||
@ -94,7 +105,7 @@ func ImportTemplates() {
|
||||
for _, tmpl := range requiredTemplates {
|
||||
|
||||
// extract the template definition from the bindata
|
||||
def := MustAssetString("templates/" + tmpl)
|
||||
def := MustAssetString("templates/" + tmpl + ".tpl")
|
||||
|
||||
// and add it to the template library
|
||||
template, err := template.New(tmpl).Parse(def)
|
||||
|
Loading…
x
Reference in New Issue
Block a user