From de4cdce2792936278aa04742a63a6760ba67d230 Mon Sep 17 00:00:00 2001 From: Josh Bleecher Snyder Date: Tue, 23 May 2017 07:43:32 -0700 Subject: correctly report installation failures Prior to this, installations failed silently. --- cmd/install/install.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmd/install') diff --git a/cmd/install/install.go b/cmd/install/install.go index 11581c1..0a93128 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) } } -- cgit v1.2.3 From e3c14b831e61871a0abd67aec472e555e26077aa Mon Sep 17 00:00:00 2001 From: Josh Bleecher Snyder Date: Tue, 23 May 2017 07:45:43 -0700 Subject: check whether rc file exists during installation --- cmd/install/install.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'cmd/install') diff --git a/cmd/install/install.go b/cmd/install/install.go index 0a93128..f6123d1 100644 --- a/cmd/install/install.go +++ b/cmd/install/install.go @@ -81,5 +81,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 } -- cgit v1.2.3 From b74be9ff548cfaa7330b1a9312612a830282228d Mon Sep 17 00:00:00 2001 From: Josh Bleecher Snyder Date: Tue, 23 May 2017 08:04:13 -0700 Subject: add .bash_profile as a bash rc file This is common on macs. --- cmd/install/install.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'cmd/install') diff --git a/cmd/install/install.go b/cmd/install/install.go index f6123d1..fb44b2b 100644 --- a/cmd/install/install.go +++ b/cmd/install/install.go @@ -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}) -- cgit v1.2.3