mirror of
https://github.com/containers/skopeo.git
synced 2025-09-10 02:59:50 +00:00
Add --format option to skopeo inspect
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
13
vendor/github.com/containers/common/pkg/report/validate.go
generated
vendored
Normal file
13
vendor/github.com/containers/common/pkg/report/validate.go
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
package report
|
||||
|
||||
import "regexp"
|
||||
|
||||
var jsonRegex = regexp.MustCompile(`^\s*(json|{{\s*json\s*(\.)?\s*}})\s*$`)
|
||||
|
||||
// JSONFormat test CLI --format string to be a JSON request
|
||||
// if report.IsJSON(cmd.Flag("format").Value.String()) {
|
||||
// ... process JSON and output
|
||||
// }
|
||||
func IsJSON(s string) bool {
|
||||
return jsonRegex.MatchString(s)
|
||||
}
|
Reference in New Issue
Block a user