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)
| 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). |
| 115 | func 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 | } |
no test coverage detected
searching dependent graphs…