diff --git a/cli/cli.go b/cli/cli.go index 442370d4de..e221a7ee7e 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -17,7 +17,7 @@ import ( func Run() { app := cli.NewApp() app.Name = path.Base(os.Args[0]) - app.Usage = "a Docker-native clustering system" + app.Usage = "A Docker-native clustering system" app.Version = version.VERSION + " (" + version.GITCOMMIT + ")" app.Author = "" @@ -59,7 +59,7 @@ func Run() { { Name: "create", ShortName: "c", - Usage: "create a cluster", + Usage: "Create a cluster", Action: func(c *cli.Context) { if len(c.Args()) != 0 { log.Fatalf("the `create` command takes no arguments. See '%s create --help'.", c.App.Name) @@ -76,7 +76,7 @@ func Run() { { Name: "list", ShortName: "l", - Usage: "list nodes in a cluster", + Usage: "List nodes in a cluster", Flags: []cli.Flag{flTimeout}, Action: func(c *cli.Context) { dflag := getDiscovery(c) @@ -109,7 +109,7 @@ func Run() { { Name: "manage", ShortName: "m", - Usage: "manage a docker cluster", + Usage: "Manage a docker cluster", Flags: []cli.Flag{ flStore, flStrategy, flFilter, @@ -122,7 +122,7 @@ func Run() { { Name: "join", ShortName: "j", - Usage: "join a docker cluster", + Usage: "Join a docker cluster", Flags: []cli.Flag{flAddr, flHeartBeat}, Action: join, }, diff --git a/cli/help.go b/cli/help.go index 9f4fe25bf8..c66dc61323 100644 --- a/cli/help.go +++ b/cli/help.go @@ -8,22 +8,40 @@ import ( ) func init() { + cli.AppHelpTemplate = `Usage: {{.Name}} {{if .Flags}}[OPTIONS] {{end}}COMMAND [arg...] + +{{.Usage}} + +Version: {{.Version}}{{if or .Author .Email}} + +Author:{{if .Author}} + {{.Author}}{{if .Email}} - <{{.Email}}>{{end}}{{else}} + {{.Email}}{{end}}{{end}} +{{if .Flags}} +Options: + {{range .Flags}}{{.}} + {{end}}{{end}} +Commands: + {{range .Commands}}{{.Name}}{{with .ShortName}}, {{.}}{{end}}{{ "\t" }}{{.Usage}} + {{end}} +Run '{{.Name}} COMMAND --help' for more information on a command. +` + // See https://github.com/codegangsta/cli/pull/171/files - cli.CommandHelpTemplate = `{{$DISCOVERY := or (eq .Name "manage") (eq .Name "join") (eq .Name "list")}}NAME: - {{.Name}} - {{.Usage}} -USAGE: - ` + path.Base(os.Args[0]) + ` {{.Name}}{{if .Flags}} [options]{{end}} {{if $DISCOVERY}}{{end}}{{if .Description}} -DESCRIPTION: - {{.Description}}{{end}}{{if $DISCOVERY}} -ARGUMENTS: - discovery{{printf "\t"}}discovery service to use [$SWARM_DISCOVERY] - {{printf "\t"}} * token:// - {{printf "\t"}} * consul:/// - {{printf "\t"}} * etcd://,/ - {{printf "\t"}} * file://path/to/file - {{printf "\t"}} * zk://,/ - {{printf "\t"}} * ,{{end}}{{if .Flags}} -OPTIONS: + cli.CommandHelpTemplate = `{{$DISCOVERY := or (eq .Name "manage") (eq .Name "join") (eq .Name "list")}}Usage: ` + path.Base(os.Args[0]) + ` {{.Name}}{{if .Flags}} [OPTIONS]{{end}} {{if $DISCOVERY}}{{end}} + +{{.Usage}}{{if $DISCOVERY}} + +Arguments: + discovery service to use [$SWARM_DISCOVERY] + * token:// + * consul:/// + * etcd://,/ + * file://path/to/file + * zk://,/ + * ,{{end}}{{if .Flags}} + +Options: {{range .Flags}}{{.}} {{end}}{{if (eq .Name "manage")}}{{printf "\t * swarm.overcommit=0.05\tovercommit to apply on resources"}} {{printf "\t * swarm.discovery.heartbeat=25s\tperiod between each heartbeat"}}{{end}}{{ end }}