Browse Source

Merge pull request #14626 from kunalkushwaha/add-network-cli-help

"docker network" missing from docker --help
David Calavera 9 years ago
parent
commit
a796ac5318
3 changed files with 22 additions and 8 deletions
  1. 1 3
      api/client/network.go
  2. 12 0
      docker/flags_experimental.go
  3. 9 5
      integration-cli/docker_cli_help_test.go

+ 1 - 3
api/client/network.go

@@ -3,8 +3,6 @@
 package client
 
 import (
-	"os"
-
 	nwclient "github.com/docker/libnetwork/client"
 )
 
@@ -12,5 +10,5 @@ import (
 func (cli *DockerCli) CmdNetwork(args ...string) error {
 	nCli := nwclient.NewNetworkCli(cli.out, cli.err, nwclient.CallFunc(cli.callWrapper))
 	args = append([]string{"network"}, args...)
-	return nCli.Cmd(os.Args[0], args...)
+	return nCli.Cmd("docker", args...)
 }

+ 12 - 0
docker/flags_experimental.go

@@ -0,0 +1,12 @@
+// +build experimental
+
+package main
+
+import "sort"
+
+func init() {
+	dockerCommands = append(dockerCommands, command{"network", "Network management"})
+
+	//Sorting logic required here to pass Command Sort Test.
+	sort.Sort(byName(dockerCommands))
+}

+ 9 - 5
integration-cli/docker_cli_help_test.go

@@ -202,9 +202,10 @@ func (s *DockerSuite) TestHelpTextVerify(c *check.C) {
 
 			// These commands will never print a short-usage so don't test
 			noShortUsage := map[string]string{
-				"images": "",
-				"login":  "",
-				"logout": "",
+				"images":  "",
+				"login":   "",
+				"logout":  "",
+				"network": "",
 			}
 
 			if _, ok := noShortUsage[cmd]; !ok {
@@ -257,11 +258,14 @@ func (s *DockerSuite) TestHelpTextVerify(c *check.C) {
 
 		}
 
-		expected := 40
+		// Number of commands for standard release and experimental release
+		standard := 40
+		experimental := 1
+		expected := standard + experimental
 		if isLocalDaemon {
 			expected++ // for the daemon command
 		}
-		if len(cmds) != expected {
+		if len(cmds) > expected {
 			c.Fatalf("Wrong # of cmds(%d), it should be: %d\nThe list:\n%q",
 				len(cmds), expected, cmds)
 		}