diff options
| author | Eyal Posener <[email protected]> | 2019-05-29 11:47:31 +0300 |
|---|---|---|
| committer | GitHub <[email protected]> | 2019-05-29 11:47:31 +0300 |
| commit | 4f4d4243bd370c967dc4d50351e0cfa024c2a7ef (patch) | |
| tree | d802706ff1801498e57544237c6a4e4a4fd80f1e /cmd/install/install.go | |
| parent | af07aa5181b38e3fa57d053328e44aaa27da5999 (diff) | |
| parent | afda8e00c6d48e7d20bff281c321bc8aca00699a (diff) | |
Merge pull request #90 from vadmeste/fix-installer
Install in ~/.bash_profile first in case of macOS
Diffstat (limited to 'cmd/install/install.go')
| -rw-r--r-- | cmd/install/install.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/cmd/install/install.go b/cmd/install/install.go index dfa1963..3cb9746 100644 --- a/cmd/install/install.go +++ b/cmd/install/install.go @@ -5,6 +5,7 @@ import ( "os" "os/user" "path/filepath" + "runtime" "github.com/hashicorp/go-multierror" ) @@ -59,7 +60,16 @@ func Uninstall(cmd string) error { } func installers() (i []installer) { - for _, rc := range [...]string{".bashrc", ".bash_profile", ".bash_login", ".profile"} { + // The list of bash config files candidates where it is + // possible to install the completion command. + var bashConfFiles []string + switch runtime.GOOS { + case "darwin": + bashConfFiles = []string{".bash_profile"} + default: + bashConfFiles = []string{".bashrc", ".bash_profile", ".bash_login", ".profile"} + } + for _, rc := range bashConfFiles { if f := rcFile(rc); f != "" { i = append(i, bash{f}) break |
