Add --format option to skopeo inspect

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
Daniel J Walsh
2020-11-17 09:03:48 -05:00
parent 82e461ff9d
commit 5d73dea577
11 changed files with 479 additions and 34 deletions

View 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)
}