diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2021-10-16 12:18:49 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2021-10-16 12:22:34 +1100 |
commit | 36210840962bb448208b6cc628319f994c392075 (patch) | |
tree | 5e0cb1fc55ff05384d12356ede5f4c3133650f53 /pkg | |
parent | 8c25aaa687a6b0432c73119c521cfea2dd11a9aa (diff) |
small changes
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/config/app_config.go | 23 | ||||
-rw-r--r-- | pkg/gui/status_panel.go | 12 |
2 files changed, 16 insertions, 19 deletions
diff --git a/pkg/config/app_config.go b/pkg/config/app_config.go index 024b7b0de..d41a9c202 100644 --- a/pkg/config/app_config.go +++ b/pkg/config/app_config.go @@ -19,9 +19,8 @@ type AppConfig struct { Name string `long:"name" env:"NAME" default:"lazygit"` BuildSource string `long:"build-source" env:"BUILD_SOURCE" default:""` UserConfig *UserConfig - UserConfigFiles []string + UserConfigPaths []string DeafultConfFiles bool - UserConfigPath string UserConfigDir string TempDir string AppState *AppState @@ -38,9 +37,8 @@ type AppConfigurer interface { GetName() string GetBuildSource() string GetUserConfig() *UserConfig - GetUserConfigFiles() []string + GetUserConfigPaths() []string GetUserConfigDir() string - GetUserConfigPath() string GetTempDir() string GetAppState() *AppState SaveAppState() error @@ -56,17 +54,17 @@ func NewAppConfig(name, version, commit, date string, buildSource string, debugg return nil, err } - var userConfigFiles []string + var userConfigPaths []string customConfigFiles := os.Getenv("LG_CONFIG_FILE") if customConfigFiles != "" { // Load user defined config files - userConfigFiles = strings.Split(customConfigFiles, ",") + userConfigPaths = strings.Split(customConfigFiles, ",") } else { // Load default config files - userConfigFiles = []string{filepath.Join(configDir, ConfigFilename)} + userConfigPaths = []string{filepath.Join(configDir, ConfigFilename)} } - userConfig, err := loadUserConfigWithDefaults(userConfigFiles) + userConfig, err := loadUserConfigWithDefaults(userConfigPaths) if err != nil { return nil, err } @@ -90,9 +88,8 @@ func NewAppConfig(name, version, commit, date string, buildSource string, debugg Debug: debuggingFlag, BuildSource: buildSource, UserConfig: userConfig, - UserConfigFiles: userConfigFiles, + UserConfigPaths: userConfigPaths, UserConfigDir: configDir, - UserConfigPath: filepath.Join(configDir, "config.yml"), TempDir: tempDir, AppState: appState, IsNewRepo: false, @@ -220,8 +217,8 @@ func (c *AppConfig) GetAppState() *AppState { return c.AppState } -func (c *AppConfig) GetUserConfigFiles() []string { - return c.UserConfigFiles +func (c *AppConfig) GetUserConfigPaths() []string { + return c.UserConfigPaths } func (c *AppConfig) GetUserConfigDir() string { @@ -233,7 +230,7 @@ func (c *AppConfig) GetTempDir() string { } func (c *AppConfig) ReloadUserConfig() error { - userConfig, err := loadUserConfigWithDefaults(c.UserConfigFiles) + userConfig, err := loadUserConfigWithDefaults(c.UserConfigPaths) if err != nil { return err } diff --git a/pkg/gui/status_panel.go b/pkg/gui/status_panel.go index 84eb8af52..0adc4d383 100644 --- a/pkg/gui/status_panel.go +++ b/pkg/gui/status_panel.go @@ -116,20 +116,20 @@ func (gui *Gui) handleStatusSelect() error { } func (gui *Gui) askForConfigFile(action func(file string) error) error { - confFiles := gui.Config.GetUserConfigFiles() - switch len(confFiles) { + confPaths := gui.Config.GetUserConfigPaths() + switch len(confPaths) { case 0: return errors.New(gui.Tr.NoConfigFileFoundErr) case 1: - return action(confFiles[0]) + return action(confPaths[0]) default: - menuItems := make([]*menuItem, len(confFiles)) - for i, file := range confFiles { + menuItems := make([]*menuItem, len(confPaths)) + for i, file := range confPaths { i := i menuItems[i] = &menuItem{ displayString: file, onPress: func() error { - return action(confFiles[i]) + return action(confPaths[i]) }, } } |