From 4cb7a3b42c968b2e84136b8670ad28f9b5cc6f5a Mon Sep 17 00:00:00 2001 From: aperum Date: Sat, 25 Jan 2020 20:33:15 +0100 Subject: [PATCH] add FreeBSD to the supported systems in config.Path (#528) --- internal/config/path.go | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/internal/config/path.go b/internal/config/path.go index 41462f3..dd99974 100644 --- a/internal/config/path.go +++ b/internal/config/path.go @@ -23,36 +23,21 @@ func Path(sys string) (string, error) { } return expanded, nil + } - // OSX config paths - } else if sys == "darwin" { - + switch sys { + case "darwin", "linux", "freebsd": paths = []string{ path.Join(os.Getenv("XDG_CONFIG_HOME"), "/cheat/conf.yml"), path.Join(os.Getenv("HOME"), ".config/cheat/conf.yml"), path.Join(os.Getenv("HOME"), ".cheat/conf.yml"), } - - // Linux config paths - } else if sys == "linux" { - - paths = []string{ - path.Join(os.Getenv("XDG_CONFIG_HOME"), "/cheat/conf.yml"), - path.Join(os.Getenv("HOME"), ".config/cheat/conf.yml"), - path.Join(os.Getenv("HOME"), ".cheat/conf.yml"), - "/etc/cheat/conf.yml", - } - - // Windows config paths - } else if sys == "windows" { - + case "windows": paths = []string{ fmt.Sprintf("%s/cheat/conf.yml", os.Getenv("APPDATA")), fmt.Sprintf("%s/cheat/conf.yml", os.Getenv("PROGRAMDATA")), } - - // Unsupported platforms - } else { + default: return "", fmt.Errorf("unsupported os: %s", sys) }