Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
17 changes: 17 additions & 0 deletions project.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down