Browse code

removed not needed [OPTIONS] and remove poor messages like 'Not enough arguments'

Victor Vieux authored on 2013/04/12 19:26:31
Showing 1 changed files
... ...
@@ -161,7 +161,7 @@ func (srv *Server) CmdLogin(stdin io.ReadCloser, stdout rcli.DockerConn, args ..
161 161
 
162 162
 // 'docker wait': block until a container stops
163 163
 func (srv *Server) CmdWait(stdin io.ReadCloser, stdout io.Writer, args ...string) error {
164
-	cmd := rcli.Subcmd(stdout, "wait", "[OPTIONS] CONTAINER [CONTAINER...]", "Block until a container stops, then print its exit code.")
164
+	cmd := rcli.Subcmd(stdout, "wait", "CONTAINER [CONTAINER...]", "Block until a container stops, then print its exit code.")
165 165
 	if err := cmd.Parse(args); err != nil {
166 166
 		return nil
167 167
 	}
... ...
@@ -217,7 +217,7 @@ func (srv *Server) CmdInfo(stdin io.ReadCloser, stdout io.Writer, args ...string
217 217
 }
218 218
 
219 219
 func (srv *Server) CmdStop(stdin io.ReadCloser, stdout io.Writer, args ...string) error {
220
-	cmd := rcli.Subcmd(stdout, "stop", "[OPTIONS] CONTAINER [CONTAINER...]", "Stop a running container")
220
+	cmd := rcli.Subcmd(stdout, "stop", "CONTAINER [CONTAINER...]", "Stop a running container")
221 221
 	if err := cmd.Parse(args); err != nil {
222 222
 		return nil
223 223
 	}
... ...
@@ -239,7 +239,7 @@ func (srv *Server) CmdStop(stdin io.ReadCloser, stdout io.Writer, args ...string
239 239
 }
240 240
 
241 241
 func (srv *Server) CmdRestart(stdin io.ReadCloser, stdout io.Writer, args ...string) error {
242
-	cmd := rcli.Subcmd(stdout, "restart", "[OPTIONS] CONTAINER [CONTAINER...]", "Restart a running container")
242
+	cmd := rcli.Subcmd(stdout, "restart", "CONTAINER [CONTAINER...]", "Restart a running container")
243 243
 	if err := cmd.Parse(args); err != nil {
244 244
 		return nil
245 245
 	}
... ...
@@ -261,7 +261,7 @@ func (srv *Server) CmdRestart(stdin io.ReadCloser, stdout io.Writer, args ...str
261 261
 }
262 262
 
263 263
 func (srv *Server) CmdStart(stdin io.ReadCloser, stdout io.Writer, args ...string) error {
264
-	cmd := rcli.Subcmd(stdout, "start", "[OPTIONS] CONTAINER [CONTAINER...]", "Start a stopped container")
264
+	cmd := rcli.Subcmd(stdout, "start", "CONTAINER [CONTAINER...]", "Start a stopped container")
265 265
 	if err := cmd.Parse(args); err != nil {
266 266
 		return nil
267 267
 	}
... ...
@@ -283,7 +283,7 @@ func (srv *Server) CmdStart(stdin io.ReadCloser, stdout io.Writer, args ...strin
283 283
 }
284 284
 
285 285
 func (srv *Server) CmdInspect(stdin io.ReadCloser, stdout io.Writer, args ...string) error {
286
-	cmd := rcli.Subcmd(stdout, "inspect", "[OPTIONS] CONTAINER", "Return low-level information on a container")
286
+	cmd := rcli.Subcmd(stdout, "inspect", "CONTAINER", "Return low-level information on a container")
287 287
 	if err := cmd.Parse(args); err != nil {
288 288
 		return nil
289 289
 	}
... ...
@@ -318,7 +318,7 @@ func (srv *Server) CmdInspect(stdin io.ReadCloser, stdout io.Writer, args ...str
318 318
 }
319 319
 
320 320
 func (srv *Server) CmdPort(stdin io.ReadCloser, stdout io.Writer, args ...string) error {
321
-	cmd := rcli.Subcmd(stdout, "port", "[OPTIONS] CONTAINER PRIVATE_PORT", "Lookup the public-facing port which is NAT-ed to PRIVATE_PORT")
321
+	cmd := rcli.Subcmd(stdout, "port", "CONTAINER PRIVATE_PORT", "Lookup the public-facing port which is NAT-ed to PRIVATE_PORT")
322 322
 	if err := cmd.Parse(args); err != nil {
323 323
 		return nil
324 324
 	}
... ...
@@ -342,7 +342,7 @@ func (srv *Server) CmdPort(stdin io.ReadCloser, stdout io.Writer, args ...string
342 342
 
343 343
 // 'docker rmi IMAGE' removes all images with the name IMAGE
344 344
 func (srv *Server) CmdRmi(stdin io.ReadCloser, stdout io.Writer, args ...string) (err error) {
345
-	cmd := rcli.Subcmd(stdout, "rmimage", "[OPTIONS] IMAGE [IMAGE...]", "Remove an image")
345
+	cmd := rcli.Subcmd(stdout, "rmimage", "IMAGE [IMAGE...]", "Remove an image")
346 346
 	if err := cmd.Parse(args); err != nil {
347 347
 		return nil
348 348
 	}
... ...
@@ -359,7 +359,7 @@ func (srv *Server) CmdRmi(stdin io.ReadCloser, stdout io.Writer, args ...string)
359 359
 }
360 360
 
361 361
 func (srv *Server) CmdHistory(stdin io.ReadCloser, stdout io.Writer, args ...string) error {
362
-	cmd := rcli.Subcmd(stdout, "history", "[OPTIONS] IMAGE", "Show the history of an image")
362
+	cmd := rcli.Subcmd(stdout, "history", "IMAGE", "Show the history of an image")
363 363
 	if err := cmd.Parse(args); err != nil {
364 364
 		return nil
365 365
 	}
... ...
@@ -385,7 +385,7 @@ func (srv *Server) CmdHistory(stdin io.ReadCloser, stdout io.Writer, args ...str
385 385
 }
386 386
 
387 387
 func (srv *Server) CmdRm(stdin io.ReadCloser, stdout io.Writer, args ...string) error {
388
-	cmd := rcli.Subcmd(stdout, "rm", "[OPTIONS] CONTAINER [CONTAINER...]", "Remove a container")
388
+	cmd := rcli.Subcmd(stdout, "rm", "CONTAINER [CONTAINER...]", "Remove a container")
389 389
 	if err := cmd.Parse(args); err != nil {
390 390
 		return nil
391 391
 	}
... ...
@@ -407,10 +407,14 @@ func (srv *Server) CmdRm(stdin io.ReadCloser, stdout io.Writer, args ...string)
407 407
 
408 408
 // 'docker kill NAME' kills a running container
409 409
 func (srv *Server) CmdKill(stdin io.ReadCloser, stdout io.Writer, args ...string) error {
410
-	cmd := rcli.Subcmd(stdout, "kill", "[OPTIONS] CONTAINER [CONTAINER...]", "Kill a running container")
410
+	cmd := rcli.Subcmd(stdout, "kill", "CONTAINER [CONTAINER...]", "Kill a running container")
411 411
 	if err := cmd.Parse(args); err != nil {
412 412
 		return nil
413 413
 	}
414
+	if cmd.NArg() < 1 {
415
+		cmd.Usage()
416
+		return nil
417
+	}
414 418
 	for _, name := range cmd.Args() {
415 419
 		container := srv.runtime.Get(name)
416 420
 		if container == nil {
... ...
@@ -425,17 +429,19 @@ func (srv *Server) CmdKill(stdin io.ReadCloser, stdout io.Writer, args ...string
425 425
 
426 426
 func (srv *Server) CmdImport(stdin io.ReadCloser, stdout rcli.DockerConn, args ...string) error {
427 427
 	stdout.Flush()
428
-	cmd := rcli.Subcmd(stdout, "import", "[OPTIONS] URL|- [REPOSITORY [TAG]]", "Create a new filesystem image from the contents of a tarball")
428
+	cmd := rcli.Subcmd(stdout, "import", "URL|- [REPOSITORY [TAG]]", "Create a new filesystem image from the contents of a tarball")
429 429
 	var archive io.Reader
430 430
 	var resp *http.Response
431 431
 
432 432
 	if err := cmd.Parse(args); err != nil {
433 433
 		return nil
434 434
 	}
435
+	if cmd.NArg() < 1 {
436
+		cmd.Usage()
437
+		return nil
438
+	}
435 439
 	src := cmd.Arg(0)
436
-	if src == "" {
437
-		return fmt.Errorf("Not enough arguments")
438
-	} else if src == "-" {
440
+	if src == "-" {
439 441
 		archive = stdin
440 442
 	} else {
441 443
 		u, err := url.Parse(src)
... ...
@@ -737,13 +743,14 @@ func (srv *Server) CmdExport(stdin io.ReadCloser, stdout io.Writer, args ...stri
737 737
 
738 738
 func (srv *Server) CmdDiff(stdin io.ReadCloser, stdout io.Writer, args ...string) error {
739 739
 	cmd := rcli.Subcmd(stdout,
740
-		"diff", "CONTAINER [OPTIONS]",
740
+		"diff", "CONTAINER",
741 741
 		"Inspect changes on a container's filesystem")
742 742
 	if err := cmd.Parse(args); err != nil {
743 743
 		return nil
744 744
 	}
745 745
 	if cmd.NArg() < 1 {
746
-		return fmt.Errorf("Not enough arguments")
746
+		cmd.Usage()
747
+		return nil
747 748
 	}
748 749
 	if container := srv.runtime.Get(cmd.Arg(0)); container == nil {
749 750
 		return fmt.Errorf("No such container")
... ...
@@ -760,7 +767,7 @@ func (srv *Server) CmdDiff(stdin io.ReadCloser, stdout io.Writer, args ...string
760 760
 }
761 761
 
762 762
 func (srv *Server) CmdLogs(stdin io.ReadCloser, stdout io.Writer, args ...string) error {
763
-	cmd := rcli.Subcmd(stdout, "logs", "[OPTIONS] CONTAINER", "Fetch the logs of a container")
763
+	cmd := rcli.Subcmd(stdout, "logs", "CONTAINER", "Fetch the logs of a container")
764 764
 	if err := cmd.Parse(args); err != nil {
765 765
 		return nil
766 766
 	}