mirror of https://github.com/docker/docs.git
better hint for windows shells
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
This commit is contained in:
parent
9aa861ea55
commit
49686b9a91
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@ package commands
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
|
@ -89,22 +88,9 @@ 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 != "" {
|
||||
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
|
||||
// of the drivers in `docker-machine create`. This method replaces the 100+
|
||||
|
|
Loading…
Reference in New Issue