From f980cc197e187d941862b99e022c5a22a48cdf84 Mon Sep 17 00:00:00 2001 From: Jess Valarezo Date: Wed, 25 Oct 2017 21:05:00 -0400 Subject: [PATCH] ctr: move images command Signed-off-by: Jess Valarezo --- cmd/ctr/{ => commands/images}/export.go | 6 ++-- cmd/ctr/{ => commands/images}/images.go | 45 ++++++++++++------------- cmd/ctr/{ => commands/images}/import.go | 6 ++-- cmd/ctr/main.go | 5 +-- 4 files changed, 31 insertions(+), 31 deletions(-) rename cmd/ctr/{ => commands/images}/export.go (95%) rename cmd/ctr/{ => commands/images}/images.go (87%) rename cmd/ctr/{ => commands/images}/import.go (93%) diff --git a/cmd/ctr/export.go b/cmd/ctr/commands/images/export.go similarity index 95% rename from cmd/ctr/export.go rename to cmd/ctr/commands/images/export.go index f2b4ea77a..26821008b 100644 --- a/cmd/ctr/export.go +++ b/cmd/ctr/commands/images/export.go @@ -1,4 +1,4 @@ -package main +package images import ( "io" @@ -12,11 +12,11 @@ import ( "github.com/urfave/cli" ) -var imagesExportCommand = cli.Command{ +var exportCommand = cli.Command{ Name: "export", Usage: "export an image", ArgsUsage: "[flags] ", - Description: `Export an image to a tar stream.`, + Description: "export an image to a tar stream", Flags: []cli.Flag{ cli.StringFlag{ Name: "oci-ref-name", diff --git a/cmd/ctr/images.go b/cmd/ctr/commands/images/images.go similarity index 87% rename from cmd/ctr/images.go rename to cmd/ctr/commands/images/images.go index 2c99bd4f9..074e118d3 100644 --- a/cmd/ctr/images.go +++ b/cmd/ctr/commands/images/images.go @@ -1,4 +1,4 @@ -package main +package images import ( "fmt" @@ -17,25 +17,26 @@ import ( "github.com/urfave/cli" ) -var imageCommand = cli.Command{ +// Command is the cli command for managing images +var Command = cli.Command{ Name: "images", Usage: "manage images", Subcommands: cli.Commands{ - imagesListCommand, - imagesCheckCommand, - imageRemoveCommand, - imagesSetLabelsCommand, - imagesImportCommand, - imagesExportCommand, + listCommand, + checkCommand, + removeCommand, + setLabelsCommand, + importCommand, + exportCommand, }, } -var imagesListCommand = cli.Command{ +var listCommand = cli.Command{ Name: "list", Aliases: []string{"ls"}, Usage: "list images known to containerd", ArgsUsage: "[flags] ", - Description: `List images registered with containerd.`, + Description: "list images registered with containerd", Flags: []cli.Flag{ cli.BoolFlag{ Name: "quiet, q", @@ -114,11 +115,11 @@ var imagesListCommand = cli.Command{ }, } -var imagesSetLabelsCommand = cli.Command{ +var setLabelsCommand = cli.Command{ Name: "label", - Usage: "set and clear labels for an image.", + Usage: "set and clear labels for an image", ArgsUsage: "[flags] [=, ...]", - Description: "Set and clear labels for an image.", + Description: "set and clear labels for an image", Flags: []cli.Flag{ cli.BoolFlag{ Name: "replace-all, r", @@ -173,12 +174,11 @@ var imagesSetLabelsCommand = cli.Command{ }, } -var imagesCheckCommand = cli.Command{ +var checkCommand = cli.Command{ Name: "check", - Usage: "Check that an image has all content available locally.", - ArgsUsage: "[flags] [, ...]", - Description: "Check that an image has all content available locally.", - Flags: []cli.Flag{}, + Usage: "check that an image has all content available locally", + ArgsUsage: " [, ...]", + Description: "check that an image has all content available locally", Action: func(context *cli.Context) error { var ( exitErr error @@ -255,13 +255,12 @@ var imagesCheckCommand = cli.Command{ }, } -var imageRemoveCommand = cli.Command{ +var removeCommand = cli.Command{ Name: "remove", Aliases: []string{"rm"}, - Usage: "Remove one or more images by reference.", - ArgsUsage: "[flags] [, ...]", - Description: `Remove one or more images by reference.`, - Flags: []cli.Flag{}, + Usage: "remove one or more images by reference", + ArgsUsage: " [, ...]", + Description: "remove one or more images by reference", Action: func(context *cli.Context) error { client, ctx, cancel, err := commands.NewClient(context) if err != nil { diff --git a/cmd/ctr/import.go b/cmd/ctr/commands/images/import.go similarity index 93% rename from cmd/ctr/import.go rename to cmd/ctr/commands/images/import.go index 1a59feec5..74f204ea9 100644 --- a/cmd/ctr/import.go +++ b/cmd/ctr/commands/images/import.go @@ -1,4 +1,4 @@ -package main +package images import ( "fmt" @@ -11,11 +11,11 @@ import ( "github.com/urfave/cli" ) -var imagesImportCommand = cli.Command{ +var importCommand = cli.Command{ Name: "import", Usage: "import an image", ArgsUsage: "[flags] ", - Description: `Import an image from a tar stream.`, + Description: "import an image from a tar stream", Flags: []cli.Flag{ cli.StringFlag{ Name: "ref-object", diff --git a/cmd/ctr/main.go b/cmd/ctr/main.go index 6b1f8ab6a..9e044b3ee 100644 --- a/cmd/ctr/main.go +++ b/cmd/ctr/main.go @@ -6,9 +6,10 @@ import ( "log" "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" 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/server" "github.com/containerd/containerd/version" @@ -75,7 +76,7 @@ containerd CLI eventsCommand, fetchCommand, fetchObjectCommand, - imageCommand, + images.Command, namespacesCommand, pprofCommand, pullCommand,