Update module github.com/containers/common to v0.51.0

Signed-off-by: Renovate Bot <bot@renovateapp.com>
This commit is contained in:
renovate[bot]
2023-01-24 16:22:22 +00:00
committed by Miloslav Trmač
parent fe15a36ed9
commit afbdaf8ecb
9 changed files with 183 additions and 201 deletions

View File

@@ -4,11 +4,11 @@ import (
"bytes"
"encoding/json"
"reflect"
"regexp"
"strings"
"text/template"
"github.com/containers/common/pkg/report/camelcase"
"github.com/containers/storage/pkg/regexp"
)
// Template embeds template.Template to add functionality to methods
@@ -88,10 +88,11 @@ func truncateWithLength(source string, length int) string {
// Array of map is returned to support range templates
// Note: unexported fields can be supported by adding field to overrides
// Note: It is left to the developer to write out said headers
// Podman commands use the general rules of:
// 1) unchanged --format includes headers
// 2) --format '{{.ID}" # no headers
// 3) --format 'table {{.ID}}' # includes headers
//
// Podman commands use the general rules of:
// 1) unchanged --format includes headers
// 2) --format '{{.ID}" # no headers
// 3) --format 'table {{.ID}}' # includes headers
func Headers(object interface{}, overrides map[string]string) []map[string]string {
value := reflect.ValueOf(object)
if value.Kind() == reflect.Ptr {
@@ -159,7 +160,7 @@ func (t *Template) IsTable() bool {
return t.isTable
}
var rangeRegex = regexp.MustCompile(`(?s){{\s*range\s*\.\s*}}.*{{\s*end\s*-?\s*}}`)
var rangeRegex = regexp.Delayed(`(?s){{\s*range\s*\.\s*}}.*{{\s*end\s*-?\s*}}`)
// EnforceRange ensures that the format string contains a range
func EnforceRange(format string) string {