mirror of https://github.com/docker/docs.git
Refactored env usage hint with @ehazlett's review comments
Signed-off-by: Tom Barlow <tomwbarlow@gmail.com>
This commit is contained in:
parent
3f76cf14ad
commit
f2b25ae3f1
17
commands.go
17
commands.go
|
@ -726,7 +726,7 @@ func cmdEnv(c *cli.Context) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
usageHint := generateUsageHint(c, userShell)
|
usageHint := generateUsageHint(c.Args().First(), userShell)
|
||||||
|
|
||||||
switch userShell {
|
switch userShell {
|
||||||
case "fish":
|
case "fish":
|
||||||
|
@ -738,27 +738,24 @@ func cmdEnv(c *cli.Context) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func generateUsageHint(c *cli.Context, userShell string) string {
|
func generateUsageHint(machineName string, userShell string) string {
|
||||||
msg := "# Run this command to configure your shell: "
|
|
||||||
cmd := ""
|
cmd := ""
|
||||||
machine := c.Args().First()
|
|
||||||
|
|
||||||
switch userShell {
|
switch userShell {
|
||||||
case "fish":
|
case "fish":
|
||||||
if machine != "" {
|
if machineName != "" {
|
||||||
cmd = fmt.Sprintf("eval (docker-machine env %s)", machine)
|
cmd = fmt.Sprintf("eval (docker-machine env %s)", machineName)
|
||||||
} else {
|
} else {
|
||||||
cmd = "eval (docker-machine env)"
|
cmd = "eval (docker-machine env)"
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
if machine != "" {
|
if machineName != "" {
|
||||||
cmd = fmt.Sprintf("eval $(docker-machine env %s)", machine)
|
cmd = fmt.Sprintf("eval $(docker-machine env %s)", machineName)
|
||||||
} else {
|
} else {
|
||||||
cmd = "eval $(docker-machine env)"
|
cmd = "eval $(docker-machine env)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return fmt.Sprintf("%s %s\n", msg, cmd)
|
return fmt.Sprintf("# Run this command to configure your shell: %s\n", cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
func cmdSsh(c *cli.Context) {
|
func cmdSsh(c *cli.Context) {
|
||||||
|
|
Loading…
Reference in New Issue