From 1136c3458bd9b9de95a90107e871940883bd07cc Mon Sep 17 00:00:00 2001 From: Daniel Nephin Date: Mon, 19 Sep 2016 13:38:58 -0400 Subject: [PATCH] Create a system subcommand for events and info. Signed-off-by: Daniel Nephin --- command/commands/commands.go | 5 +++-- command/system/cmd.go | 27 +++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 command/system/cmd.go diff --git a/command/commands/commands.go b/command/commands/commands.go index d618233997..a25abf0c56 100644 --- a/command/commands/commands.go +++ b/command/commands/commands.go @@ -29,16 +29,17 @@ func AddCommands(cmd *cobra.Command, dockerCli *command.DockerCli) { swarm.NewSwarmCommand(dockerCli), container.NewContainerCommand(dockerCli), image.NewImageCommand(dockerCli), + system.NewSystemCommand(dockerCli), container.NewRunCommand(dockerCli), image.NewBuildCommand(dockerCli), network.NewNetworkCommand(dockerCli), - system.NewEventsCommand(dockerCli), + hide(system.NewEventsCommand(dockerCli)), registry.NewLoginCommand(dockerCli), registry.NewLogoutCommand(dockerCli), registry.NewSearchCommand(dockerCli), system.NewVersionCommand(dockerCli), volume.NewVolumeCommand(dockerCli), - system.NewInfoCommand(dockerCli), + hide(system.NewInfoCommand(dockerCli)), hide(container.NewAttachCommand(dockerCli)), hide(container.NewCommitCommand(dockerCli)), hide(container.NewCopyCommand(dockerCli)), diff --git a/command/system/cmd.go b/command/system/cmd.go new file mode 100644 index 0000000000..8ce9d93ae7 --- /dev/null +++ b/command/system/cmd.go @@ -0,0 +1,27 @@ +package system + +import ( + "fmt" + + "github.com/spf13/cobra" + + "github.com/docker/docker/cli" + "github.com/docker/docker/cli/command" +) + +// NewSystemCommand returns a cobra command for `system` subcommands +func NewSystemCommand(dockerCli *command.DockerCli) *cobra.Command { + cmd := &cobra.Command{ + Use: "system", + Short: "Manage Docker", + Args: cli.NoArgs, + Run: func(cmd *cobra.Command, args []string) { + fmt.Fprintf(dockerCli.Err(), "\n"+cmd.UsageString()) + }, + } + cmd.AddCommand( + NewEventsCommand(dockerCli), + NewInfoCommand(dockerCli), + ) + return cmd +}