From 99fb2c1baa2b8edd87ae10b1fc6f65aebe7a18e7 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Wed, 30 Jan 2019 01:06:09 +0100 Subject: [PATCH] Hide "builder" and "network" commands on old API versions - The `/build/prune` endpoint was added in API v1.31 - The `/network` endpoints were added in API v1.21 This patch hides these commands on older API versions Before this change: ``` DOCKER_API_VERSION=1.0 docker ... Management Commands: builder Manage builds container Manage containers image Manage images manifest Manage Docker image manifests and manifest lists network Manage networks system Manage Docker trust Manage trust on Docker images ``` After this change ``` DOCKER_API_VERSION=1.0 docker ... Management Commands: container Manage containers image Manage images manifest Manage Docker image manifests and manifest lists system Manage Docker trust Manage trust on Docker images ``` Signed-off-by: Sebastiaan van Stijn --- cli/command/builder/cmd.go | 9 +++++---- cli/command/network/cmd.go | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/cli/command/builder/cmd.go b/cli/command/builder/cmd.go index 288322afa3..b5f4d0d9eb 100644 --- a/cli/command/builder/cmd.go +++ b/cli/command/builder/cmd.go @@ -10,10 +10,11 @@ import ( // NewBuilderCommand returns a cobra command for `builder` subcommands func NewBuilderCommand(dockerCli command.Cli) *cobra.Command { cmd := &cobra.Command{ - Use: "builder", - Short: "Manage builds", - Args: cli.NoArgs, - RunE: command.ShowHelp(dockerCli.Err()), + Use: "builder", + Short: "Manage builds", + Args: cli.NoArgs, + RunE: command.ShowHelp(dockerCli.Err()), + Annotations: map[string]string{"version": "1.31"}, } cmd.AddCommand( NewPruneCommand(dockerCli), diff --git a/cli/command/network/cmd.go b/cli/command/network/cmd.go index 48edf1c4e3..028e1377f0 100644 --- a/cli/command/network/cmd.go +++ b/cli/command/network/cmd.go @@ -10,10 +10,11 @@ import ( // NewNetworkCommand returns a cobra command for `network` subcommands func NewNetworkCommand(dockerCli command.Cli) *cobra.Command { cmd := &cobra.Command{ - Use: "network", - Short: "Manage networks", - Args: cli.NoArgs, - RunE: command.ShowHelp(dockerCli.Err()), + Use: "network", + Short: "Manage networks", + Args: cli.NoArgs, + RunE: command.ShowHelp(dockerCli.Err()), + Annotations: map[string]string{"version": "1.21"}, } cmd.AddCommand( newConnectCommand(dockerCli),