From 648f2f8bc5a4230be2b603acc6d99cb211a360cb Mon Sep 17 00:00:00 2001 From: Antonio Murdaca Date: Thu, 17 Mar 2016 11:55:49 +0100 Subject: [PATCH] output raw manifest for v2 registries Signed-off-by: Antonio Murdaca --- inspect.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/inspect.go b/inspect.go index 08e5add4..7830dd4c 100644 --- a/inspect.go +++ b/inspect.go @@ -15,7 +15,27 @@ var inspectCmd = cli.Command{ Name: "inspect", Usage: "inspect images on a registry", ArgsUsage: ``, + Flags: []cli.Flag{ + cli.BoolFlag{ + Name: "raw", + Usage: "output raw manifest", + }, + }, Action: func(c *cli.Context) { + if c.Bool("raw") { + img, err := parseImage(c.Args().First()) + if err != nil { + logrus.Fatal(err) + } + // TODO(runcom): this is not falling back to v1 + // TODO(runcom): hardcoded schema 2 version 1 + b, err := img.RawManifest("2-1") + if err != nil { + logrus.Fatal(err) + } + fmt.Println(string(b)) + return + } // get the Image interface before inspecting...utils.go parseImage imgInspect, err := inspect(c) if err != nil {