mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-30 03:23:08 +03:00
Move NewDummyCommon to pkg/common
It's too special for a utils package, and it als makes sense to put it right next to the thing that it is a dummy for.
This commit is contained in:
@ -3,11 +3,7 @@ package utils
|
||||
import (
|
||||
"io"
|
||||
|
||||
"github.com/jesseduffield/lazygit/pkg/common"
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
"github.com/jesseduffield/lazygit/pkg/i18n"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/spf13/afero"
|
||||
)
|
||||
|
||||
// NewDummyLog creates a new dummy Log for testing
|
||||
@ -16,28 +12,3 @@ func NewDummyLog() *logrus.Entry {
|
||||
log.Out = io.Discard
|
||||
return log.WithField("test", "test")
|
||||
}
|
||||
|
||||
func NewDummyCommon() *common.Common {
|
||||
tr := i18n.EnglishTranslationSet()
|
||||
cmn := &common.Common{
|
||||
Log: NewDummyLog(),
|
||||
Tr: tr,
|
||||
Fs: afero.NewOsFs(),
|
||||
}
|
||||
cmn.SetUserConfig(config.GetDefaultConfig())
|
||||
return cmn
|
||||
}
|
||||
|
||||
func NewDummyCommonWithUserConfigAndAppState(userConfig *config.UserConfig, appState *config.AppState) *common.Common {
|
||||
tr := i18n.EnglishTranslationSet()
|
||||
cmn := &common.Common{
|
||||
Log: NewDummyLog(),
|
||||
Tr: tr,
|
||||
AppState: appState,
|
||||
// TODO: remove dependency on actual filesystem in tests and switch to using
|
||||
// in-memory for everything
|
||||
Fs: afero.NewOsFs(),
|
||||
}
|
||||
cmn.SetUserConfig(userConfig)
|
||||
return cmn
|
||||
}
|
||||
|
Reference in New Issue
Block a user