MCPcopy Index your code
hub / github.com/docker/cli / newVersionTemplate

Function newVersionTemplate

cli/command/system/version.go:240–252  ·  view source on GitHub ↗
(templateFormat string)

Source from the content-addressed store, hash-verified

238}
239
240func newVersionTemplate(templateFormat string) (*template.Template, error) {
241 switch templateFormat {
242 case "":
243 templateFormat = defaultVersionTemplate
244 case formatter.JSONFormatKey:
245 templateFormat = formatter.JSONFormat
246 }
247 tmpl, err := templates.New("version").Funcs(template.FuncMap{"getDetailsOrder": getDetailsOrder}).Parse(templateFormat)
248 if err != nil {
249 return nil, fmt.Errorf("template parsing error: %w", err)
250 }
251 return tmpl, nil
252}
253
254func getDetailsOrder(v system.ComponentVersion) []string {
255 out := make([]string, 0, len(v.Details))

Callers 2

TestVersionFormatFunction · 0.85
runVersionFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestVersionFormatFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…