summaryrefslogtreecommitdiff
path: root/vendor
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2021-02-05 12:03:35 -0500
committerDaniel J Walsh <dwalsh@redhat.com>2021-02-05 12:03:35 -0500
commite3348e905255d359782d96002f9930cd2012544e (patch)
tree8281ba6c03c1133b0204c1af14a9bfc0c066f947 /vendor
parentc2a298ea933b7860c8c1f8fda8946a19d214152c (diff)
downloadpodman-e3348e905255d359782d96002f9930cd2012544e.tar.gz
podman-e3348e905255d359782d96002f9930cd2012544e.tar.bz2
podman-e3348e905255d359782d96002f9930cd2012544e.zip
Bump to v0.33.4
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'vendor')
-rw-r--r--vendor/github.com/containers/common/pkg/report/template.go48
-rw-r--r--vendor/github.com/containers/common/version/version.go2
-rw-r--r--vendor/modules.txt2
3 files changed, 39 insertions, 13 deletions
diff --git a/vendor/github.com/containers/common/pkg/report/template.go b/vendor/github.com/containers/common/pkg/report/template.go
index 914a26a74..559c1625b 100644
--- a/vendor/github.com/containers/common/pkg/report/template.go
+++ b/vendor/github.com/containers/common/pkg/report/template.go
@@ -1,6 +1,8 @@
package report
import (
+ "bytes"
+ "encoding/json"
"reflect"
"strings"
"text/template"
@@ -21,22 +23,30 @@ type FuncMap template.FuncMap
var tableReplacer = strings.NewReplacer(
"table ", "",
`\t`, "\t",
- `\n`, "\n",
" ", "\t",
)
// escapedReplacer will clean up escaped characters from CLI
var escapedReplacer = strings.NewReplacer(
`\t`, "\t",
- `\n`, "\n",
)
-var defaultFuncs = FuncMap{
- "join": strings.Join,
- "lower": strings.ToLower,
- "split": strings.Split,
- "title": strings.Title,
- "upper": strings.ToUpper,
+var DefaultFuncs = FuncMap{
+ "join": strings.Join,
+ "json": func(v interface{}) string {
+ buf := &bytes.Buffer{}
+ enc := json.NewEncoder(buf)
+ enc.SetEscapeHTML(false)
+ enc.Encode(v)
+ // Remove the trailing new line added by the encoder
+ return strings.TrimSpace(buf.String())
+ },
+ "lower": strings.ToLower,
+ "pad": padWithSpace,
+ "split": strings.Split,
+ "title": strings.Title,
+ "truncate": truncateWithLength,
+ "upper": strings.ToUpper,
}
// NormalizeFormat reads given go template format provided by CLI and munges it into what we need
@@ -55,6 +65,22 @@ func NormalizeFormat(format string) string {
return f
}
+// padWithSpace adds spaces*prefix and spaces*suffix to the input when it is non-empty
+func padWithSpace(source string, prefix, suffix int) string {
+ if source == "" {
+ return source
+ }
+ return strings.Repeat(" ", prefix) + source + strings.Repeat(" ", suffix)
+}
+
+// truncateWithLength truncates the source string up to the length provided by the input
+func truncateWithLength(source string, length int) string {
+ if len(source) < length {
+ return source
+ }
+ return source[:length]
+}
+
// Headers queries the interface for field names.
// Array of map is returned to support range templates
// Note: unexported fields can be supported by adding field to overrides
@@ -96,7 +122,7 @@ func Headers(object interface{}, overrides map[string]string) []map[string]strin
// NewTemplate creates a new template object
func NewTemplate(name string) *Template {
- return &Template{Template: template.New(name).Funcs(template.FuncMap(defaultFuncs))}
+ return &Template{Template: template.New(name).Funcs(template.FuncMap(DefaultFuncs))}
}
// Parse parses text as a template body for t
@@ -108,7 +134,7 @@ func (t *Template) Parse(text string) (*Template, error) {
text = NormalizeFormat(text)
}
- tt, err := t.Template.Funcs(template.FuncMap(defaultFuncs)).Parse(text)
+ tt, err := t.Template.Funcs(template.FuncMap(DefaultFuncs)).Parse(text)
return &Template{tt, t.isTable}, err
}
@@ -116,7 +142,7 @@ func (t *Template) Parse(text string) (*Template, error) {
// A default template function will be replace if there is a key collision.
func (t *Template) Funcs(funcMap FuncMap) *Template {
m := make(FuncMap)
- for k, v := range defaultFuncs {
+ for k, v := range DefaultFuncs {
m[k] = v
}
for k, v := range funcMap {
diff --git a/vendor/github.com/containers/common/version/version.go b/vendor/github.com/containers/common/version/version.go
index e099c1809..464ed1ad7 100644
--- a/vendor/github.com/containers/common/version/version.go
+++ b/vendor/github.com/containers/common/version/version.go
@@ -1,4 +1,4 @@
package version
// Version is the version of the build.
-const Version = "0.33.3"
+const Version = "0.33.4"
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 649c8a8ee..d80e42fcd 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -89,7 +89,7 @@ github.com/containers/buildah/pkg/parse
github.com/containers/buildah/pkg/rusage
github.com/containers/buildah/pkg/supplemented
github.com/containers/buildah/util
-# github.com/containers/common v0.33.3
+# github.com/containers/common v0.33.4
github.com/containers/common/pkg/apparmor
github.com/containers/common/pkg/apparmor/internal/supported
github.com/containers/common/pkg/auth