ctr: move images command

Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
This commit is contained in:
Jess Valarezo 2017-10-25 21:05:00 -04:00
parent 47fae4dd17
commit f980cc197e
4 changed files with 31 additions and 31 deletions

View File

@ -1,4 +1,4 @@
package main package images
import ( import (
"io" "io"
@ -12,11 +12,11 @@ import (
"github.com/urfave/cli" "github.com/urfave/cli"
) )
var imagesExportCommand = cli.Command{ var exportCommand = cli.Command{
Name: "export", Name: "export",
Usage: "export an image", Usage: "export an image",
ArgsUsage: "[flags] <out> <image>", ArgsUsage: "[flags] <out> <image>",
Description: `Export an image to a tar stream.`, Description: "export an image to a tar stream",
Flags: []cli.Flag{ Flags: []cli.Flag{
cli.StringFlag{ cli.StringFlag{
Name: "oci-ref-name", Name: "oci-ref-name",

View File

@ -1,4 +1,4 @@
package main package images
import ( import (
"fmt" "fmt"
@ -17,25 +17,26 @@ import (
"github.com/urfave/cli" "github.com/urfave/cli"
) )
var imageCommand = cli.Command{ // Command is the cli command for managing images
var Command = cli.Command{
Name: "images", Name: "images",
Usage: "manage images", Usage: "manage images",
Subcommands: cli.Commands{ Subcommands: cli.Commands{
imagesListCommand, listCommand,
imagesCheckCommand, checkCommand,
imageRemoveCommand, removeCommand,
imagesSetLabelsCommand, setLabelsCommand,
imagesImportCommand, importCommand,
imagesExportCommand, exportCommand,
}, },
} }
var imagesListCommand = cli.Command{ var listCommand = cli.Command{
Name: "list", Name: "list",
Aliases: []string{"ls"}, Aliases: []string{"ls"},
Usage: "list images known to containerd", Usage: "list images known to containerd",
ArgsUsage: "[flags] <ref>", ArgsUsage: "[flags] <ref>",
Description: `List images registered with containerd.`, Description: "list images registered with containerd",
Flags: []cli.Flag{ Flags: []cli.Flag{
cli.BoolFlag{ cli.BoolFlag{
Name: "quiet, q", Name: "quiet, q",
@ -114,11 +115,11 @@ var imagesListCommand = cli.Command{
}, },
} }
var imagesSetLabelsCommand = cli.Command{ var setLabelsCommand = cli.Command{
Name: "label", Name: "label",
Usage: "set and clear labels for an image.", Usage: "set and clear labels for an image",
ArgsUsage: "[flags] <name> [<key>=<value>, ...]", ArgsUsage: "[flags] <name> [<key>=<value>, ...]",
Description: "Set and clear labels for an image.", Description: "set and clear labels for an image",
Flags: []cli.Flag{ Flags: []cli.Flag{
cli.BoolFlag{ cli.BoolFlag{
Name: "replace-all, r", Name: "replace-all, r",
@ -173,12 +174,11 @@ var imagesSetLabelsCommand = cli.Command{
}, },
} }
var imagesCheckCommand = cli.Command{ var checkCommand = cli.Command{
Name: "check", Name: "check",
Usage: "Check that an image has all content available locally.", Usage: "check that an image has all content available locally",
ArgsUsage: "[flags] <ref> [<ref>, ...]", ArgsUsage: "<ref> [<ref>, ...]",
Description: "Check that an image has all content available locally.", Description: "check that an image has all content available locally",
Flags: []cli.Flag{},
Action: func(context *cli.Context) error { Action: func(context *cli.Context) error {
var ( var (
exitErr error exitErr error
@ -255,13 +255,12 @@ var imagesCheckCommand = cli.Command{
}, },
} }
var imageRemoveCommand = cli.Command{ var removeCommand = cli.Command{
Name: "remove", Name: "remove",
Aliases: []string{"rm"}, Aliases: []string{"rm"},
Usage: "Remove one or more images by reference.", Usage: "remove one or more images by reference",
ArgsUsage: "[flags] <ref> [<ref>, ...]", ArgsUsage: "<ref> [<ref>, ...]",
Description: `Remove one or more images by reference.`, Description: "remove one or more images by reference",
Flags: []cli.Flag{},
Action: func(context *cli.Context) error { Action: func(context *cli.Context) error {
client, ctx, cancel, err := commands.NewClient(context) client, ctx, cancel, err := commands.NewClient(context)
if err != nil { if err != nil {

View File

@ -1,4 +1,4 @@
package main package images
import ( import (
"fmt" "fmt"
@ -11,11 +11,11 @@ import (
"github.com/urfave/cli" "github.com/urfave/cli"
) )
var imagesImportCommand = cli.Command{ var importCommand = cli.Command{
Name: "import", Name: "import",
Usage: "import an image", Usage: "import an image",
ArgsUsage: "[flags] <ref> <in>", ArgsUsage: "[flags] <ref> <in>",
Description: `Import an image from a tar stream.`, Description: "import an image from a tar stream",
Flags: []cli.Flag{ Flags: []cli.Flag{
cli.StringFlag{ cli.StringFlag{
Name: "ref-object", Name: "ref-object",

View File

@ -6,9 +6,10 @@ import (
"log" "log"
"os" "os"
"github.com/containerd/containerd/cmd/ctr/commands/containers"
"github.com/containerd/containerd/cmd/ctr/commands/images"
"github.com/containerd/containerd/cmd/ctr/commands/plugins" "github.com/containerd/containerd/cmd/ctr/commands/plugins"
versionCmd "github.com/containerd/containerd/cmd/ctr/commands/version" versionCmd "github.com/containerd/containerd/cmd/ctr/commands/version"
"github.com/containerd/containerd/cmd/ctr/commands/containers"
"github.com/containerd/containerd/namespaces" "github.com/containerd/containerd/namespaces"
"github.com/containerd/containerd/server" "github.com/containerd/containerd/server"
"github.com/containerd/containerd/version" "github.com/containerd/containerd/version"
@ -75,7 +76,7 @@ containerd CLI
eventsCommand, eventsCommand,
fetchCommand, fetchCommand,
fetchObjectCommand, fetchObjectCommand,
imageCommand, images.Command,
namespacesCommand, namespacesCommand,
pprofCommand, pprofCommand,
pullCommand, pullCommand,