MCPcopy Create free account
hub / github.com/containerd/nerdctl / ParseTemplate

Function ParseTemplate

pkg/formatter/common.go:115–123  ·  view source on GitHub ↗

ParseTemplate wraps github.com/docker/cli/templates.Parse() to allow `json` as an alias of `{{json .}}`. ParseTemplate can be removed when https://github.com/docker/cli/pull/3355 gets merged and tagged (Docker 22.XX).

(format string)

Source from the content-addressed store, hash-verified

113// ParseTemplate wraps github.com/docker/cli/templates.Parse() to allow `json` as an alias of `{{json .}}`.
114// ParseTemplate can be removed when https://github.com/docker/cli/pull/3355 gets merged and tagged (Docker 22.XX).
115func ParseTemplate(format string) (*template.Template, error) {
116 aliases := map[string]string{
117 "json": "{{json .}}",
118 }
119 if alias, ok := aliases[format]; ok {
120 format = alias
121 }
122 return templates.Parse(format)
123}

Callers 13

StatsFunction · 0.92
printImagesFunction · 0.92
ListFunction · 0.92
ListFunction · 0.92
ListFunction · 0.92
printSearchResultsFunction · 0.92
lsPrintOutputFunction · 0.92
InfoFunction · 0.92
EventsFunction · 0.92
versionActionFunction · 0.92
printHistoryFunction · 0.92

Calls 1

ParseMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…