commit 4c5fa92f6e1098851877774159db950af7ca5c48 Author: Antonio Murdaca Date: Sun Jan 17 18:28:53 2016 +0100 initial commit Signed-off-by: Antonio Murdaca diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..7650fdea --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +skopeo diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..06ef8365 --- /dev/null +++ b/Makefile @@ -0,0 +1,13 @@ +export GOPATH:=$(CURDIR)/Godeps/_workspace:$(GOPATH) + +BINDIR=${DESTDIR}/usr/local/bin/ + +all: + go build -o skopeo . + +install: + install -d -m 0755 ${BINDIR} + install -m 755 skopeo ${BINDIR} + +clean: + rm -f skopeo diff --git a/inspect.go b/inspect.go new file mode 100644 index 00000000..a12833cd --- /dev/null +++ b/inspect.go @@ -0,0 +1,29 @@ +package main + +import ( + "github.com/docker/docker/reference" + engineTypes "github.com/docker/engine-api/types" + containerTypes "github.com/docker/engine-api/types/container" +) + +type ImageInspect struct { + ID string `json:"Id"` + RepoTags []string + RepoDigests []string + Parent string + Comment string + Created string + Container string + ContainerConfig *containerTypes.Config + DockerVersion string + Author string + Config *containerTypes.Config + Architecture string + Os string + Size int64 + Registry string +} + +func inspect(ref reference.Named, authConfig engineTypes.AuthConfig) (string, error) { + return "", nil +} diff --git a/inspect_v1.go b/inspect_v1.go new file mode 100644 index 00000000..06ab7d0f --- /dev/null +++ b/inspect_v1.go @@ -0,0 +1 @@ +package main diff --git a/inspect_v2.go b/inspect_v2.go new file mode 100644 index 00000000..06ab7d0f --- /dev/null +++ b/inspect_v2.go @@ -0,0 +1 @@ +package main diff --git a/main.go b/main.go new file mode 100644 index 00000000..f75d72e6 --- /dev/null +++ b/main.go @@ -0,0 +1,77 @@ +package main + +import ( + "fmt" + "os" + + "github.com/Sirupsen/logrus" + "github.com/codegangsta/cli" + "github.com/docker/docker/reference" + engineTypes "github.com/docker/engine-api/types" +) + +const ( + version = "0.0.1" + usage = "inspect images" +) + +var inspectCmd = func(c *cli.Context) { + ref, err := reference.ParseNamed(c.Args().First()) + if err != nil { + logrus.Fatal(err) + } + + var ( + authConfig engineTypes.AuthConfig + username = c.GlobalString("username") + password = c.GlobalString("password") + ) + if username != "" && password != "" { + authConfig = engineTypes.AuthConfig{ + Username: username, + Password: password, + } + } + imgInspect, err := inspect(ref, authConfig) + if err != nil { + logrus.Fatal(err) + } + fmt.Println(imgInspect) +} + +func main() { + app := cli.NewApp() + app.Name = "skopeo" + app.Version = version + app.Usage = usage + app.Flags = []cli.Flag{ + cli.BoolFlag{ + Name: "debug", + Usage: "enable debug output for logging", + }, + //cli.BoolFlag{ + //Name: "tags", + //Usage: "show tags" + //}, + cli.StringFlag{ + Name: "username", + Value: "", + Usage: "registry username", + }, + cli.StringFlag{ + Name: "password", + Value: "", + Usage: "registry password", + }, + } + app.Before = func(c *cli.Context) error { + if c.GlobalBool("debug") { + logrus.SetLevel(logrus.DebugLevel) + } + return nil + } + app.Action = inspectCmd + if err := app.Run(os.Args); err != nil { + logrus.Fatal(err) + } +}