From fdb68599214bbb47d59cc23ddff7f9b86735bbe1 Mon Sep 17 00:00:00 2001 From: Jess Valarezo Date: Wed, 25 Oct 2017 22:00:14 -0400 Subject: [PATCH] ctr: move namespaces command Signed-off-by: Jess Valarezo --- .../{ => commands/namespaces}/namespaces.go | 44 +++++++++---------- cmd/ctr/main.go | 3 +- 2 files changed, 24 insertions(+), 23 deletions(-) rename cmd/ctr/{ => commands/namespaces}/namespaces.go (76%) diff --git a/cmd/ctr/namespaces.go b/cmd/ctr/commands/namespaces/namespaces.go similarity index 76% rename from cmd/ctr/namespaces.go rename to cmd/ctr/commands/namespaces/namespaces.go index a1d93c26b..ec0ba3739 100644 --- a/cmd/ctr/namespaces.go +++ b/cmd/ctr/commands/namespaces/namespaces.go @@ -1,4 +1,4 @@ -package main +package namespaces import ( "fmt" @@ -14,22 +14,23 @@ import ( "github.com/urfave/cli" ) -var namespacesCommand = cli.Command{ +// Command is the cli command for managing namespaces +var Command = cli.Command{ Name: "namespaces", Usage: "manage namespaces", Subcommands: cli.Commands{ - namespacesCreateCommand, - namespacesSetLabelsCommand, - namespacesListCommand, - namespacesRemoveCommand, + createCommand, + setLabelsCommand, + listCommand, + removeCommand, }, } -var namespacesCreateCommand = cli.Command{ +var createCommand = cli.Command{ Name: "create", - Usage: "create a new namespace.", - ArgsUsage: "[flags] [= [= [=, ...]", - Description: "Set and clear labels for a namespace.", - Flags: []cli.Flag{}, + Usage: "set and clear labels for a namespace", + ArgsUsage: " [=, ...]", + Description: "set and clear labels for a namespace", Action: func(context *cli.Context) error { namespace, labels := commands.ObjectWithLabelArgs(context) if namespace == "" { @@ -71,16 +71,16 @@ var namespacesSetLabelsCommand = cli.Command{ }, } -var namespacesListCommand = cli.Command{ +var listCommand = cli.Command{ Name: "list", Aliases: []string{"ls"}, - Usage: "list namespaces.", + Usage: "list namespaces", ArgsUsage: "[flags]", - Description: "List namespaces.", + Description: "list namespaces", Flags: []cli.Flag{ cli.BoolFlag{ Name: "quiet, q", - Usage: "print only the namespace name.", + Usage: "print only the namespace name", }, }, Action: func(context *cli.Context) error { @@ -123,12 +123,12 @@ var namespacesListCommand = cli.Command{ }, } -var namespacesRemoveCommand = cli.Command{ +var removeCommand = cli.Command{ Name: "remove", Aliases: []string{"rm"}, Usage: "remove one or more namespaces", - ArgsUsage: "[flags] [, ...]", - Description: "Remove one or more namespaces. For now, the namespace must be empty.", + ArgsUsage: " [, ...]", + Description: "remove one or more namespaces. for now, the namespace must be empty", Action: func(context *cli.Context) error { var exitErr error client, ctx, cancel, err := commands.NewClient(context) diff --git a/cmd/ctr/main.go b/cmd/ctr/main.go index d0e1397bc..dd9829df2 100644 --- a/cmd/ctr/main.go +++ b/cmd/ctr/main.go @@ -9,6 +9,7 @@ import ( "github.com/containerd/containerd/cmd/ctr/commands/containers" "github.com/containerd/containerd/cmd/ctr/commands/content" "github.com/containerd/containerd/cmd/ctr/commands/images" + namespacesCmd "github.com/containerd/containerd/cmd/ctr/commands/namespaces" "github.com/containerd/containerd/cmd/ctr/commands/plugins" "github.com/containerd/containerd/cmd/ctr/commands/snapshot" versionCmd "github.com/containerd/containerd/cmd/ctr/commands/version" @@ -79,7 +80,7 @@ containerd CLI fetchCommand, fetchObjectCommand, images.Command, - namespacesCommand, + namespacesCmd.Command, pprofCommand, pullCommand, pushCommand,