mirror of
https://github.com/containers/podman.git
synced 2025-11-14 10:09:20 +08:00
updated common to 0.35.0
Signed-off-by: Parker Van Roy <pvanroy@redhat.com>
This commit is contained in:
16
vendor/github.com/containers/common/pkg/report/template.go
generated
vendored
16
vendor/github.com/containers/common/pkg/report/template.go
generated
vendored
@@ -4,6 +4,7 @@ import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"strings"
|
||||
"text/template"
|
||||
|
||||
@@ -155,3 +156,18 @@ func (t *Template) Funcs(funcMap FuncMap) *Template {
|
||||
func (t *Template) IsTable() bool {
|
||||
return t.isTable
|
||||
}
|
||||
|
||||
var rangeRegex = regexp.MustCompile(`{{\s*range\s*\.\s*}}.*{{\s*end\s*}}`)
|
||||
|
||||
// EnforceRange ensures that the format string contains a range
|
||||
func EnforceRange(format string) string {
|
||||
if !rangeRegex.MatchString(format) {
|
||||
return "{{range .}}" + format + "{{end}}"
|
||||
}
|
||||
return format
|
||||
}
|
||||
|
||||
// HasTable returns whether the format is a table
|
||||
func HasTable(format string) bool {
|
||||
return strings.HasPrefix(format, "table ")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user