Browse code

always display help in the same order

Victor Vieux authored on 2013/05/30 23:08:26
Showing 1 changed files
... ...
@@ -73,37 +73,37 @@ func (cli *DockerCli) CmdHelp(args ...string) error {
73 73
 		}
74 74
 	}
75 75
 	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)
76
-	for cmd, description := range map[string]string{
77
-		"attach":  "Attach to a running container",
78
-		"build":   "Build a container from a Dockerfile",
79
-		"commit":  "Create a new image from a container's changes",
80
-		"diff":    "Inspect changes on a container's filesystem",
81
-		"export":  "Stream the contents of a container as a tar archive",
82
-		"history": "Show the history of an image",
83
-		"images":  "List images",
84
-		"import":  "Create a new filesystem image from the contents of a tarball",
85
-		"info":    "Display system-wide information",
86
-		"insert":  "Insert a file in an image",
87
-		"inspect": "Return low-level information on a container",
88
-		"kill":    "Kill a running container",
89
-		"login":   "Register or Login to the docker registry server",
90
-		"logs":    "Fetch the logs of a container",
91
-		"port":    "Lookup the public-facing port which is NAT-ed to PRIVATE_PORT",
92
-		"ps":      "List containers",
93
-		"pull":    "Pull an image or a repository from the docker registry server",
94
-		"push":    "Push an image or a repository to the docker registry server",
95
-		"restart": "Restart a running container",
96
-		"rm":      "Remove a container",
97
-		"rmi":     "Remove an image",
98
-		"run":     "Run a command in a new container",
99
-		"search":  "Search for an image in the docker index",
100
-		"start":   "Start a stopped container",
101
-		"stop":    "Stop a running container",
102
-		"tag":     "Tag an image into a repository",
103
-		"version": "Show the docker version information",
104
-		"wait":    "Block until a container stops, then print its exit code",
76
+	for _, command := range [][2]string{
77
+		{"attach", "Attach to a running container"},
78
+		{"build", "Build a container from a Dockerfile"},
79
+		{"commit", "Create a new image from a container's changes"},
80
+		{"diff", "Inspect changes on a container's filesystem"},
81
+		{"export", "Stream the contents of a container as a tar archive"},
82
+		{"history", "Show the history of an image"},
83
+		{"images", "List images"},
84
+		{"import", "Create a new filesystem image from the contents of a tarball"},
85
+		{"info", "Display system-wide information"},
86
+		{"insert", "Insert a file in an image"},
87
+		{"inspect", "Return low-level information on a container"},
88
+		{"kill", "Kill a running container"},
89
+		{"login", "Register or Login to the docker registry server"},
90
+		{"logs", "Fetch the logs of a container"},
91
+		{"port", "Lookup the public-facing port which is NAT-ed to PRIVATE_PORT"},
92
+		{"ps", "List containers"},
93
+		{"pull", "Pull an image or a repository from the docker registry server"},
94
+		{"push", "Push an image or a repository to the docker registry server"},
95
+		{"restart", "Restart a running container"},
96
+		{"rm", "Remove a container"},
97
+		{"rmi", "Remove an image"},
98
+		{"run", "Run a command in a new container"},
99
+		{"search", "Search for an image in the docker index"},
100
+		{"start", "Start a stopped container"},
101
+		{"stop", "Stop a running container"},
102
+		{"tag", "Tag an image into a repository"},
103
+		{"version", "Show the docker version information"},
104
+		{"wait", "Block until a container stops}, then print its exit code"},
105 105
 	} {
106
-		help += fmt.Sprintf("    %-10.10s%s\n", cmd, description)
106
+		help += fmt.Sprintf("    %-10.10s%s\n", command[0], command[1])
107 107
 	}
108 108
 	fmt.Println(help)
109 109
 	return nil