mirror of
				https://github.com/cheat/cheat.git
				synced 2025-11-04 07:45:28 +01:00 
			
		
		
		
	Merge pull request #573 from chrisallenlane/linux-conf
fix(config): add /etc/cheat config path
This commit is contained in:
		@@ -17,7 +17,7 @@ import (
 | 
			
		||||
	"github.com/cheat/cheat/internal/installer"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
const version = "4.0.1"
 | 
			
		||||
const version = "4.0.2"
 | 
			
		||||
 | 
			
		||||
func main() {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -36,10 +36,10 @@ func Paths(
 | 
			
		||||
			paths = append(paths, path.Join(xdgpath, "/cheat/conf.yml"))
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// if `XDG_CONFIG_HOME` is not set, search the user's home directory
 | 
			
		||||
		paths = append(paths, []string{
 | 
			
		||||
			path.Join(home, ".config/cheat/conf.yml"),
 | 
			
		||||
			path.Join(home, ".cheat/conf.yml"),
 | 
			
		||||
			"/etc/cheat/conf.yml",
 | 
			
		||||
		}...)
 | 
			
		||||
 | 
			
		||||
		return paths, nil
 | 
			
		||||
 
 | 
			
		||||
@@ -39,6 +39,7 @@ func TestValidatePathsNix(t *testing.T) {
 | 
			
		||||
			"/home/bar/cheat/conf.yml",
 | 
			
		||||
			"/home/foo/.config/cheat/conf.yml",
 | 
			
		||||
			"/home/foo/.cheat/conf.yml",
 | 
			
		||||
			"/etc/cheat/conf.yml",
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// assert that output matches expectations
 | 
			
		||||
@@ -81,6 +82,7 @@ func TestValidatePathsNixNoXDG(t *testing.T) {
 | 
			
		||||
		want := []string{
 | 
			
		||||
			"/home/foo/.config/cheat/conf.yml",
 | 
			
		||||
			"/home/foo/.cheat/conf.yml",
 | 
			
		||||
			"/etc/cheat/conf.yml",
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// assert that output matches expectations
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user