spiegel_podman/cmd/podman/parse/json.go
Valentin Rothberg 1fb32b9b2f version/info: format: allow more json variants
Allow more variants to yield json output for `podman version` and
`podman info`.  Instead of comparing strings, use a regex and add
unit and e2e tests.

Fixes: #6927
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-07-22 14:42:53 -04:00

9 lines
201 B
Go

package parse
import "regexp"
var jsonFormatRegex = regexp.MustCompile(`^(\s*json\s*|\s*{{\s*json\s*\.\s*}}\s*)$`)
func MatchesJSONFormat(s string) bool {
return jsonFormatRegex.Match([]byte(s))
}