summaryrefslogtreecommitdiff
path: root/cmd/install/install.go
diff options
context:
space:
mode:
authorEyal Posener <[email protected]>2017-05-23 19:33:44 +0300
committerGitHub <[email protected]>2017-05-23 19:33:44 +0300
commit8a418a6ab0e75f89eb3c6e5ed76cca082914bb6d (patch)
treeb511c8d0fd4923b42e7dd5d3cb8c9e0ee08609f9 /cmd/install/install.go
parent3e6cff0740a53c8e9d6106ad29a4fd1bc4536c99 (diff)
parentb74be9ff548cfaa7330b1a9312612a830282228d (diff)
Merge pull request #38 from josharian/fix-installer
Fix installer
Diffstat (limited to 'cmd/install/install.go')
-rw-r--r--cmd/install/install.go15
1 files changed, 11 insertions, 4 deletions
diff --git a/cmd/install/install.go b/cmd/install/install.go
index 11581c1..fb44b2b 100644
--- a/cmd/install/install.go
+++ b/cmd/install/install.go
@@ -29,7 +29,7 @@ func Install(cmd string) error {
for _, i := range is {
errI := i.Install(cmd, bin)
if errI != nil {
- multierror.Append(err, errI)
+ err = multierror.Append(err, errI)
}
}
@@ -59,8 +59,11 @@ func Uninstall(cmd string) error {
}
func installers() (i []installer) {
- if f := rcFile(".bashrc"); f != "" {
- i = append(i, bash{f})
+ for _, rc := range [...]string{".bashrc", ".bash_profile"} {
+ if f := rcFile(rc); f != "" {
+ i = append(i, bash{f})
+ break
+ }
}
if f := rcFile(".zshrc"); f != "" {
i = append(i, zsh{f})
@@ -81,5 +84,9 @@ func rcFile(name string) string {
if err != nil {
return ""
}
- return filepath.Join(u.HomeDir, name)
+ path := filepath.Join(u.HomeDir, name)
+ if _, err := os.Stat(path); err != nil {
+ return ""
+ }
+ return path
}