1
0
mirror of https://github.com/docker/docs.git synced 2026-11-05 00:14:17 +03:00
Files
docs/commands/detectshell.go
Stefan Scherer d394cffe49 Auto-detect shell on Windows
Signed-off-by: Stefan Scherer <scherer_stefan@icloud.com>
2016-01-03 03:35:12 +01:00

25 lines
431 B
Go

// +build !windows
package commands
import (
"fmt"
"os"
"path/filepath"
)
func detectShell() (string, error) {
shell := os.Getenv("SHELL")
if shell == "" {
fmt.Printf("The default lines below are for a sh/bash shell, you can specify the shell you're using, with the --shell flag.\n\n")
return "", ErrUnknownShell
}
if os.Getenv("__fish_bin_dir") != "" {
return "fish", nil
}
return filepath.Base(shell), nil
}