summaryrefslogtreecommitdiffstats
path: root/pkg/app/app.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2021-12-29 12:03:35 +1100
committerJesse Duffield <jessedduffield@gmail.com>2022-01-04 09:07:15 +1100
commit192a548c9957807d9d5c9c4700dffe02c1f55f03 (patch)
tree7627ded8fc1fccfcb2442cbfaf8009eb55e2c07f /pkg/app/app.go
parent01ea5813a8e3b8e914332002e744e3328f55f6cd (diff)
refactoring the config struct
Diffstat (limited to 'pkg/app/app.go')
-rw-r--r--pkg/app/app.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/pkg/app/app.go b/pkg/app/app.go
index 9fae9e2d0..747f5205f 100644
--- a/pkg/app/app.go
+++ b/pkg/app/app.go
@@ -96,13 +96,15 @@ func newLogger(config config.AppConfigurer) *logrus.Entry {
// NewApp bootstrap a new application
func NewApp(config config.AppConfigurer, filterPath string) (*App, error) {
+ userConfig := config.GetUserConfig()
+
app := &App{
closers: []io.Closer{},
Config: config,
}
var err error
log := newLogger(config)
- tr, err := i18n.NewTranslationSetFromConfig(log, config.GetUserConfig().Gui.Language)
+ tr, err := i18n.NewTranslationSetFromConfig(log, userConfig.Gui.Language)
if err != nil {
return app, err
}
@@ -110,7 +112,7 @@ func NewApp(config config.AppConfigurer, filterPath string) (*App, error) {
app.Common = &common.Common{
Log: log,
Tr: tr,
- UserConfig: config.GetUserConfig(),
+ UserConfig: userConfig,
Debug: config.GetDebug(),
}
@@ -122,7 +124,7 @@ func NewApp(config config.AppConfigurer, filterPath string) (*App, error) {
app.OSCommand = oscommands.NewOSCommand(app.Common)
- app.Updater, err = updates.NewUpdater(log, config, app.OSCommand, app.Tr)
+ app.Updater, err = updates.NewUpdater(app.Common, config, app.OSCommand)
if err != nil {
return app, err
}
@@ -135,7 +137,6 @@ func NewApp(config config.AppConfigurer, filterPath string) (*App, error) {
app.GitCommand, err = commands.NewGitCommand(
app.Common,
app.OSCommand,
- app.Config,
git_config.NewStdCachedGitConfig(app.Log),
)
if err != nil {
@@ -207,7 +208,7 @@ func (app *App) setupRepo() (bool, error) {
}
shouldInitRepo := true
- notARepository := app.Config.GetUserConfig().NotARepository
+ notARepository := app.UserConfig.NotARepository
if notARepository == "prompt" {
// Offer to initialize a new repository in current directory.
fmt.Print(app.Tr.CreateRepo)