From 9a20470f29ae40903e1c7fda6c181c9aeafc40e3 Mon Sep 17 00:00:00 2001 From: Alex Komissarov Date: Sat, 3 Oct 2020 23:58:29 +0500 Subject: [PATCH 1/2] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ea139d6..2ea77d4 100644 --- a/README.md +++ b/README.md @@ -153,8 +153,8 @@ keywords: ### Issue Title Transformation You can apply project local issue title transformations. Create -`.snitch.yaml` file in the root of the project with the following -content: +`.snitch.yaml` file in the root of the project or in +`$HOME/.config/snitch/snitch.yaml` with the following content: ```yaml title: From e965d2fd2aa58b00d65deb72d5be095f276425d2 Mon Sep 17 00:00:00 2001 From: Alex Komissarov Date: Sat, 3 Oct 2020 23:59:11 +0500 Subject: [PATCH 2/2] Add chech for config file in $XDG_CONFIG_HOME --- project.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/project.go b/project.go index e0deb4c..63d9241 100644 --- a/project.go +++ b/project.go @@ -272,6 +272,23 @@ func yamlConfigPath(projectPath string) (string, bool) { } } + var xdgConfig string + if pathToConfig := os.Getenv("XDG_CONFIG_HOME"); pathToConfig != "" { + xdgConfig = pathToConfig + } else { + xdgConfig = path.Join(os.Getenv("HOME"), ".config") + } + + pathToConfig := path.Join(xdgConfig, "snitch/snitch.yaml") + if stat, err := os.Stat(pathToConfig); !os.IsNotExist(err) && !stat.IsDir() { + return pathToConfig, true + } + + pathToConfig = path.Join(xdgConfig, "snitch/snitch.yml") + if stat, err := os.Stat(pathToConfig); !os.IsNotExist(err) && !stat.IsDir() { + return pathToConfig, true + } + return "", false }