summaryrefslogtreecommitdiff
path: root/cmd/install/install.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/install/install.go')
-rw-r--r--cmd/install/install.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/cmd/install/install.go b/cmd/install/install.go
index 082a226..4a70624 100644
--- a/cmd/install/install.go
+++ b/cmd/install/install.go
@@ -68,9 +68,36 @@ func installers() (i []installer) {
if f := rcFile(".zshrc"); f != "" {
i = append(i, zsh{f})
}
+ if d := fishConfigDir(); d != "" {
+ i = append(i, fish{d})
+ }
return
}
+func fishConfigDir() string {
+ configDir := filepath.Join(getConfigHomePath(), "fish")
+ if configDir == "" {
+ return ""
+ }
+ if info, err := os.Stat(configDir); err != nil || !info.IsDir() {
+ return ""
+ }
+ return configDir
+}
+
+func getConfigHomePath() string {
+ u, err := user.Current()
+ if err != nil {
+ return ""
+ }
+
+ configHome := os.Getenv("XDG_CONFIG_HOME")
+ if configHome == "" {
+ return filepath.Join(u.HomeDir, ".config")
+ }
+ return configHome
+}
+
func getBinaryPath() (string, error) {
bin, err := os.Executable()
if err != nil {