diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2018-08-16 18:43:46 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2018-08-16 18:43:46 +1000 |
commit | fd3ce215763f227c9ab7b4e03c9b2a391ab45719 (patch) | |
tree | 76beeb6115ff36ef0aa0de4efb4b720ccdb3ea96 | |
parent | 29ed9715580e991eb8c2c508cbf58910d544be6d (diff) |
use yaml for config file rather than json
-rw-r--r-- | pkg/config/app_config.go | 19 |
1 files changed, 10 insertions, 9 deletions
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 + `) } |