From fd3ce215763f227c9ab7b4e03c9b2a391ab45719 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Thu, 16 Aug 2018 18:43:46 +1000 Subject: use yaml for config file rather than json --- pkg/config/app_config.go | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'pkg/config') diff --git a/pkg/config/app_config.go b/pkg/config/app_config.go index ec3414a55..68c065e33 100644 --- a/pkg/config/app_config.go +++ b/pkg/config/app_config.go @@ -82,7 +82,7 @@ func (c *AppConfig) GetUserConfig() *viper.Viper { // LoadUserConfig gets the user's config func LoadUserConfig() (*viper.Viper, error) { v := viper.New() - v.SetConfigType("json") + v.SetConfigType("yaml") defaults := getDefaultConfig() err := v.ReadConfig(bytes.NewBuffer(defaults)) if err != nil { @@ -90,7 +90,7 @@ func LoadUserConfig() (*viper.Viper, error) { } v.SetConfigName("config") configPath := homeDirectory() + "/lazygit/" - if _, err := os.Stat(filepath.FromSlash(configPath + "config.json")); !os.IsNotExist(err) { + if _, err := os.Stat(filepath.FromSlash(configPath + "config.yaml")); !os.IsNotExist(err) { v.AddConfigPath(configPath) err = v.MergeInConfig() if err != nil { @@ -103,13 +103,14 @@ func LoadUserConfig() (*viper.Viper, error) { func getDefaultConfig() []byte { return []byte(` - { - "gui": { - "scrollHeight": 1 - }, - "git": {}, - "os": {} - } + gui: + ## stuff relating to the UI + scrollHeight: 2 + git: + # stuff relating to git + os: + # stuff relating to the OS + `) } -- cgit v1.2.3