From 49686b9a91dba23b9715ae2db6d189e3721e96c0 Mon Sep 17 00:00:00 2001 From: Evan Hazlett Date: Thu, 30 Apr 2015 10:36:38 -0400 Subject: [PATCH] better hint for windows shells Signed-off-by: Evan Hazlett --- commands/commands.go | 5 +++-- commands/create.go | 18 ++---------------- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/commands/commands.go b/commands/commands.go index 20536caa65..8aae28cfb1 100644 --- a/commands/commands.go +++ b/commands/commands.go @@ -5,6 +5,7 @@ import ( "fmt" "os" "path/filepath" + "runtime" "sort" "strings" @@ -658,8 +659,8 @@ func detectShell() (string, error) { // attempt to get the SHELL env var shell := filepath.Base(os.Getenv("SHELL")) // none detected; check for windows env - if shell == "." && os.Getenv("windir") != "" { - log.Printf("On Windows, please specify either cmd or powershell with the --shell flag.\n\n") + if runtime.GOOS == "windows" { + log.Printf("On Windows, please specify either 'cmd' or 'powershell' with the --shell flag.\n\n") return "", ErrUnknownShell } diff --git a/commands/create.go b/commands/create.go index 5d00d8e705..db36895762 100644 --- a/commands/create.go +++ b/commands/create.go @@ -2,7 +2,6 @@ package commands import ( "fmt" - "os" "path/filepath" log "github.com/Sirupsen/logrus" @@ -89,21 +88,8 @@ func cmdCreate(c *cli.Context) { log.Fatalf("error setting active host: %v", err) } - info := "" - userShell := filepath.Base(os.Getenv("SHELL")) - - switch userShell { - case "fish": - info = fmt.Sprintf("%s env %s | source", c.App.Name, name) - default: - info = fmt.Sprintf(`eval "$(%s env %s)"`, c.App.Name, name) - } - - log.Infof("%q has been created and is now the active machine.", name) - - if info != "" { - log.Infof("To point your Docker client at it, run this in your shell: %s", info) - } + info := fmt.Sprintf("%s env %s", c.App.Name, name) + log.Infof("To point your Docker client at it, run this in your shell: %s", info) } // If the user has specified a driver, they should not see the flags for all