瀏覽代碼

Merge pull request #750 from dotcloud/ensure_order_help-fix

Always display help in the same order
Guillaume J. Charmes 12 年之前
父節點
當前提交
194fca8347
共有 1 個文件被更改,包括 30 次插入30 次删除
  1. 30 30
      commands.go

+ 30 - 30
commands.go

@@ -73,37 +73,37 @@ func (cli *DockerCli) CmdHelp(args ...string) error {
 		}
 		}
 	}
 	}
 	help := fmt.Sprintf("Usage: docker [OPTIONS] COMMAND [arg...]\n  -H=\"%s:%d\": Host:port to bind/connect to\n\nA self-sufficient runtime for linux containers.\n\nCommands:\n", cli.host, cli.port)
 	help := fmt.Sprintf("Usage: docker [OPTIONS] COMMAND [arg...]\n  -H=\"%s:%d\": Host:port to bind/connect to\n\nA self-sufficient runtime for linux containers.\n\nCommands:\n", cli.host, cli.port)
-	for cmd, description := range map[string]string{
-		"attach":  "Attach to a running container",
-		"build":   "Build a container from a Dockerfile",
-		"commit":  "Create a new image from a container's changes",
-		"diff":    "Inspect changes on a container's filesystem",
-		"export":  "Stream the contents of a container as a tar archive",
-		"history": "Show the history of an image",
-		"images":  "List images",
-		"import":  "Create a new filesystem image from the contents of a tarball",
-		"info":    "Display system-wide information",
-		"insert":  "Insert a file in an image",
-		"inspect": "Return low-level information on a container",
-		"kill":    "Kill a running container",
-		"login":   "Register or Login to the docker registry server",
-		"logs":    "Fetch the logs of a container",
-		"port":    "Lookup the public-facing port which is NAT-ed to PRIVATE_PORT",
-		"ps":      "List containers",
-		"pull":    "Pull an image or a repository from the docker registry server",
-		"push":    "Push an image or a repository to the docker registry server",
-		"restart": "Restart a running container",
-		"rm":      "Remove a container",
-		"rmi":     "Remove an image",
-		"run":     "Run a command in a new container",
-		"search":  "Search for an image in the docker index",
-		"start":   "Start a stopped container",
-		"stop":    "Stop a running container",
-		"tag":     "Tag an image into a repository",
-		"version": "Show the docker version information",
-		"wait":    "Block until a container stops, then print its exit code",
+	for _, command := range [][2]string{
+		{"attach", "Attach to a running container"},
+		{"build", "Build a container from a Dockerfile"},
+		{"commit", "Create a new image from a container's changes"},
+		{"diff", "Inspect changes on a container's filesystem"},
+		{"export", "Stream the contents of a container as a tar archive"},
+		{"history", "Show the history of an image"},
+		{"images", "List images"},
+		{"import", "Create a new filesystem image from the contents of a tarball"},
+		{"info", "Display system-wide information"},
+		{"insert", "Insert a file in an image"},
+		{"inspect", "Return low-level information on a container"},
+		{"kill", "Kill a running container"},
+		{"login", "Register or Login to the docker registry server"},
+		{"logs", "Fetch the logs of a container"},
+		{"port", "Lookup the public-facing port which is NAT-ed to PRIVATE_PORT"},
+		{"ps", "List containers"},
+		{"pull", "Pull an image or a repository from the docker registry server"},
+		{"push", "Push an image or a repository to the docker registry server"},
+		{"restart", "Restart a running container"},
+		{"rm", "Remove a container"},
+		{"rmi", "Remove an image"},
+		{"run", "Run a command in a new container"},
+		{"search", "Search for an image in the docker index"},
+		{"start", "Start a stopped container"},
+		{"stop", "Stop a running container"},
+		{"tag", "Tag an image into a repository"},
+		{"version", "Show the docker version information"},
+		{"wait", "Block until a container stops}, then print its exit code"},
 	} {
 	} {
-		help += fmt.Sprintf("    %-10.10s%s\n", cmd, description)
+		help += fmt.Sprintf("    %-10.10s%s\n", command[0], command[1])
 	}
 	}
 	fmt.Println(help)
 	fmt.Println(help)
 	return nil
 	return nil