mirror of https://github.com/docker/docs.git
Use actual binary name instead of hardcoding it
Signed-off-by: Radek Simko <radek.simko@gmail.com>
This commit is contained in:
parent
cb0baf349e
commit
a1f4e44f09
11
help.go
11
help.go
|
@ -1,13 +1,18 @@
|
|||
package main
|
||||
|
||||
import "github.com/codegangsta/cli"
|
||||
import (
|
||||
"os"
|
||||
"path"
|
||||
|
||||
"github.com/codegangsta/cli"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
||||
// 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:
|
||||
swarm {{.Name}}{{if .Flags}} [options]{{end}} {{if $DISCOVERY}}<discovery>{{end}}{{if .Description}}
|
||||
` + path.Base(os.Args[0]) + ` {{.Name}}{{if .Flags}} [options]{{end}} {{if $DISCOVERY}}<discovery>{{end}}{{if .Description}}
|
||||
DESCRIPTION:
|
||||
{{.Description}}{{end}}{{if $DISCOVERY}}
|
||||
ARGUMENTS:
|
||||
|
|
2
join.go
2
join.go
|
@ -17,7 +17,7 @@ func checkAddrFormat(addr string) bool {
|
|||
func join(c *cli.Context) {
|
||||
dflag := getDiscovery(c)
|
||||
if dflag == "" {
|
||||
log.Fatal("discovery required to join a cluster. See 'swarm join --help'.")
|
||||
log.Fatalf("discovery required to join a cluster. See '%s join --help'.", c.App.Name)
|
||||
}
|
||||
|
||||
d, err := discovery.New(dflag, c.Int("heartbeat"))
|
||||
|
|
5
main.go
5
main.go
|
@ -3,6 +3,7 @@ package main
|
|||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/codegangsta/cli"
|
||||
|
@ -18,7 +19,7 @@ import (
|
|||
|
||||
func main() {
|
||||
app := cli.NewApp()
|
||||
app.Name = "swarm"
|
||||
app.Name = path.Base(os.Args[0])
|
||||
app.Usage = "a Docker-native clustering system"
|
||||
app.Version = "0.1.0"
|
||||
app.Author = ""
|
||||
|
@ -78,7 +79,7 @@ func main() {
|
|||
Action: func(c *cli.Context) {
|
||||
dflag := getDiscovery(c)
|
||||
if dflag == "" {
|
||||
log.Fatal("discovery required to list a cluster. See 'swarm list --help'.")
|
||||
log.Fatalf("discovery required to list a cluster. See '%s list --help'.", c.App.Name)
|
||||
}
|
||||
|
||||
d, err := discovery.New(dflag, 0)
|
||||
|
|
|
@ -83,7 +83,7 @@ func manage(c *cli.Context) {
|
|||
|
||||
dflag := getDiscovery(c)
|
||||
if dflag == "" {
|
||||
log.Fatal("discovery required to manage a cluster. See 'swarm manage --help'.")
|
||||
log.Fatalf("discovery required to manage a cluster. See '%s manage --help'.", c.App.Name)
|
||||
}
|
||||
|
||||
s, err := strategy.New(c.String("strategy"))
|
||||
|
|
Loading…
Reference in New Issue