update usage to look more like the engine/machine

Signed-off-by: Victor Vieux <victorvieux@gmail.com>
This commit is contained in:
Victor Vieux 2015-05-15 11:38:35 -07:00
parent 2fd48d8ac4
commit a43f10adc4
2 changed files with 38 additions and 20 deletions

View File

@ -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,
},

View File

@ -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}}<discovery>{{end}}{{if .Description}}
DESCRIPTION:
{{.Description}}{{end}}{{if $DISCOVERY}}
ARGUMENTS:
discovery{{printf "\t"}}discovery service to use [$SWARM_DISCOVERY]
{{printf "\t"}} * token://<token>
{{printf "\t"}} * consul://<ip>/<path>
{{printf "\t"}} * etcd://<ip1>,<ip2>/<path>
{{printf "\t"}} * file://path/to/file
{{printf "\t"}} * zk://<ip1>,<ip2>/<path>
{{printf "\t"}} * <ip1>,<ip2>{{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}}<discovery>{{end}}
{{.Usage}}{{if $DISCOVERY}}
Arguments:
<discovery> discovery service to use [$SWARM_DISCOVERY]
* token://<token>
* consul://<ip>/<path>
* etcd://<ip1>,<ip2>/<path>
* file://path/to/file
* zk://<ip1>,<ip2>/<path>
* <ip1>,<ip2>{{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 }}