mirror of
https://github.com/podman-container-tools/podman.git
synced 2026-08-07 17:36:22 +00:00
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>
9 lines
201 B
Go
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))
|
|
}
|