diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2019-02-18 21:29:43 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2019-02-18 21:29:43 +1100 |
commit | 76a27f417fc7fd24b4fdf12f0aeeb94ecca958d3 (patch) | |
tree | 2c75a15e6facb18b1f5ff1831cf67d5664b796dd /pkg/app/app.go | |
parent | adc252901944e84433cb8a50de9b114ba120282d (diff) |
rename any commit
Diffstat (limited to 'pkg/app/app.go')
-rw-r--r-- | pkg/app/app.go | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/pkg/app/app.go b/pkg/app/app.go index 54706682c..e1f6654af 100644 --- a/pkg/app/app.go +++ b/pkg/app/app.go @@ -20,13 +20,14 @@ import ( type App struct { closers []io.Closer - Config config.AppConfigurer - Log *logrus.Entry - OSCommand *commands.OSCommand - GitCommand *commands.GitCommand - Gui *gui.Gui - Tr *i18n.Localizer - Updater *updates.Updater // may only need this on the Gui + Config config.AppConfigurer + Log *logrus.Entry + OSCommand *commands.OSCommand + GitCommand *commands.GitCommand + Gui *gui.Gui + Tr *i18n.Localizer + Updater *updates.Updater // may only need this on the Gui + DemonContext string } func newProductionLogger(config config.AppConfigurer) *logrus.Logger { @@ -54,7 +55,7 @@ func newDevelopmentLogger(config config.AppConfigurer) *logrus.Logger { func newLogger(config config.AppConfigurer) *logrus.Entry { var log *logrus.Logger environment := "production" - if config.GetDebug() { + if config.GetDebug() || os.Getenv("DEBUG") == "TRUE" { environment = "development" log = newDevelopmentLogger(config) } else { @@ -86,15 +87,21 @@ func NewApp(config config.AppConfigurer) (*App, error) { } var err error app.Log = newLogger(config) - app.OSCommand = commands.NewOSCommand(app.Log, config) - app.Tr = i18n.NewLocalizer(app.Log) + // if we are being called in 'demon' mode, we can just return here + app.DemonContext = os.Getenv("LAZYGIT_CONTEXT") + if app.DemonContext != "" { + return app, nil + } + + app.OSCommand = commands.NewOSCommand(app.Log, config) + app.Updater, err = updates.NewUpdater(app.Log, config, app.OSCommand, app.Tr) if err != nil { return app, err } - app.GitCommand, err = commands.NewGitCommand(app.Log, app.OSCommand, app.Tr) + app.GitCommand, err = commands.NewGitCommand(app.Log, app.OSCommand, app.Tr, app.Config) if err != nil { return app, err } @@ -106,9 +113,21 @@ func NewApp(config config.AppConfigurer) (*App, error) { } func (app *App) Run() error { + if app.DemonContext == "INTERACTIVE_REBASE" { + return app.Rebase() + } + return app.Gui.RunWithSubprocesses() } +func (app *App) Rebase() error { + app.Log.Error("TEST") + + ioutil.WriteFile(".git/rebase-merge/git-rebase-todo", []byte(os.Getenv("LAZYGIT_REBASE_TODO")), 0644) + + return nil +} + // Close closes any resources func (app *App) Close() error { for _, closer := range app.closers { |