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
|
package main
|
||||||
|
|
||||||
import "github.com/codegangsta/cli"
|
import (
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
|
||||||
|
"github.com/codegangsta/cli"
|
||||||
|
)
|
||||||
|
|
||||||
func init() {
|
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:
|
cli.CommandHelpTemplate = `{{$DISCOVERY := or (eq .Name "manage") (eq .Name "join") (eq .Name "list")}}NAME:
|
||||||
{{.Name}} - {{.Usage}}
|
{{.Name}} - {{.Usage}}
|
||||||
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:
|
||||||
{{.Description}}{{end}}{{if $DISCOVERY}}
|
{{.Description}}{{end}}{{if $DISCOVERY}}
|
||||||
ARGUMENTS:
|
ARGUMENTS:
|
||||||
|
|
2
join.go
2
join.go
|
@ -17,7 +17,7 @@ func checkAddrFormat(addr string) bool {
|
||||||
func join(c *cli.Context) {
|
func join(c *cli.Context) {
|
||||||
dflag := getDiscovery(c)
|
dflag := getDiscovery(c)
|
||||||
if dflag == "" {
|
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"))
|
d, err := discovery.New(dflag, c.Int("heartbeat"))
|
||||||
|
|
5
main.go
5
main.go
|
@ -3,6 +3,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"path"
|
||||||
|
|
||||||
log "github.com/Sirupsen/logrus"
|
log "github.com/Sirupsen/logrus"
|
||||||
"github.com/codegangsta/cli"
|
"github.com/codegangsta/cli"
|
||||||
|
@ -18,7 +19,7 @@ import (
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
app := cli.NewApp()
|
app := cli.NewApp()
|
||||||
app.Name = "swarm"
|
app.Name = path.Base(os.Args[0])
|
||||||
app.Usage = "a Docker-native clustering system"
|
app.Usage = "a Docker-native clustering system"
|
||||||
app.Version = "0.1.0"
|
app.Version = "0.1.0"
|
||||||
app.Author = ""
|
app.Author = ""
|
||||||
|
@ -78,7 +79,7 @@ func main() {
|
||||||
Action: func(c *cli.Context) {
|
Action: func(c *cli.Context) {
|
||||||
dflag := getDiscovery(c)
|
dflag := getDiscovery(c)
|
||||||
if dflag == "" {
|
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)
|
d, err := discovery.New(dflag, 0)
|
||||||
|
|
|
@ -83,7 +83,7 @@ func manage(c *cli.Context) {
|
||||||
|
|
||||||
dflag := getDiscovery(c)
|
dflag := getDiscovery(c)
|
||||||
if dflag == "" {
|
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"))
|
s, err := strategy.New(c.String("strategy"))
|
||||||
|
|
Loading…
Reference in New Issue