mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 20:36:03 +02:00
UserConfigPath -> UserConfigDir
This commit is contained in:
parent
0d25d113c9
commit
379dcf0972
2 changed files with 24 additions and 24 deletions
|
@ -13,16 +13,16 @@ import (
|
||||||
|
|
||||||
// AppConfig contains the base configuration fields required for lazygit.
|
// AppConfig contains the base configuration fields required for lazygit.
|
||||||
type AppConfig struct {
|
type AppConfig struct {
|
||||||
Debug bool `long:"debug" env:"DEBUG" default:"false"`
|
Debug bool `long:"debug" env:"DEBUG" default:"false"`
|
||||||
Version string `long:"version" env:"VERSION" default:"unversioned"`
|
Version string `long:"version" env:"VERSION" default:"unversioned"`
|
||||||
Commit string `long:"commit" env:"COMMIT"`
|
Commit string `long:"commit" env:"COMMIT"`
|
||||||
BuildDate string `long:"build-date" env:"BUILD_DATE"`
|
BuildDate string `long:"build-date" env:"BUILD_DATE"`
|
||||||
Name string `long:"name" env:"NAME" default:"lazygit"`
|
Name string `long:"name" env:"NAME" default:"lazygit"`
|
||||||
BuildSource string `long:"build-source" env:"BUILD_SOURCE" default:""`
|
BuildSource string `long:"build-source" env:"BUILD_SOURCE" default:""`
|
||||||
UserConfig *viper.Viper
|
UserConfig *viper.Viper
|
||||||
UserConfigPath string
|
UserConfigDir string
|
||||||
AppState *AppState
|
AppState *AppState
|
||||||
IsNewRepo bool
|
IsNewRepo bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// AppConfigurer interface allows individual app config structs to inherit Fields
|
// AppConfigurer interface allows individual app config structs to inherit Fields
|
||||||
|
@ -35,7 +35,7 @@ type AppConfigurer interface {
|
||||||
GetName() string
|
GetName() string
|
||||||
GetBuildSource() string
|
GetBuildSource() string
|
||||||
GetUserConfig() *viper.Viper
|
GetUserConfig() *viper.Viper
|
||||||
GetUserConfigPath() string
|
GetUserConfigDir() string
|
||||||
GetAppState() *AppState
|
GetAppState() *AppState
|
||||||
WriteToUserConfig(string, string) error
|
WriteToUserConfig(string, string) error
|
||||||
SaveAppState() error
|
SaveAppState() error
|
||||||
|
@ -56,16 +56,16 @@ func NewAppConfig(name, version, commit, date string, buildSource string, debugg
|
||||||
}
|
}
|
||||||
|
|
||||||
appConfig := &AppConfig{
|
appConfig := &AppConfig{
|
||||||
Name: "lazygit",
|
Name: "lazygit",
|
||||||
Version: version,
|
Version: version,
|
||||||
Commit: commit,
|
Commit: commit,
|
||||||
BuildDate: date,
|
BuildDate: date,
|
||||||
Debug: debuggingFlag,
|
Debug: debuggingFlag,
|
||||||
BuildSource: buildSource,
|
BuildSource: buildSource,
|
||||||
UserConfig: userConfig,
|
UserConfig: userConfig,
|
||||||
UserConfigPath: userConfigPath,
|
UserConfigDir: filepath.Dir(userConfigPath),
|
||||||
AppState: &AppState{},
|
AppState: &AppState{},
|
||||||
IsNewRepo: false,
|
IsNewRepo: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := appConfig.LoadAppState(); err != nil {
|
if err := appConfig.LoadAppState(); err != nil {
|
||||||
|
@ -126,8 +126,8 @@ func (c *AppConfig) GetAppState() *AppState {
|
||||||
return c.AppState
|
return c.AppState
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *AppConfig) GetUserConfigPath() string {
|
func (c *AppConfig) GetUserConfigDir() string {
|
||||||
return c.UserConfigPath
|
return c.UserConfigDir
|
||||||
}
|
}
|
||||||
|
|
||||||
func newViper(filename string) (*viper.Viper, error) {
|
func newViper(filename string) (*viper.Viper, error) {
|
||||||
|
|
|
@ -260,7 +260,7 @@ func (u *Updater) downloadAndInstall(rawUrl string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
g := new(getter.HttpGetter)
|
g := new(getter.HttpGetter)
|
||||||
configDir := filepath.Dir(u.Config.GetUserConfigPath())
|
configDir := u.Config.GetUserConfigDir()
|
||||||
u.Log.Info("Download directory is " + configDir)
|
u.Log.Info("Download directory is " + configDir)
|
||||||
|
|
||||||
// Get it!
|
// Get it!
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue