diff options
Diffstat (limited to 'pkg/commands/oscommands/dummies.go')
-rw-r--r-- | pkg/commands/oscommands/dummies.go | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/pkg/commands/oscommands/dummies.go b/pkg/commands/oscommands/dummies.go index 3d8b1a833..158e9a9c1 100644 --- a/pkg/commands/oscommands/dummies.go +++ b/pkg/commands/oscommands/dummies.go @@ -1,6 +1,7 @@ package oscommands import ( + "github.com/jesseduffield/lazygit/pkg/common" "github.com/jesseduffield/lazygit/pkg/utils" ) @@ -11,6 +12,34 @@ func NewDummyOSCommand() *OSCommand { return osCmd } +type OSCommandDeps struct { + Common *common.Common + Platform *Platform + GetenvFn func(string) string + RemoveFileFn func(string) error + Cmd *CmdObjBuilder +} + +func NewDummyOSCommandWithDeps(deps OSCommandDeps) *OSCommand { + common := deps.Common + if common == nil { + common = utils.NewDummyCommon() + } + + platform := deps.Platform + if platform == nil { + platform = dummyPlatform + } + + return &OSCommand{ + Common: common, + Platform: platform, + getenvFn: deps.GetenvFn, + removeFileFn: deps.RemoveFileFn, + guiIO: NewNullGuiIO(utils.NewDummyLog()), + } +} + func NewDummyCmdObjBuilder(runner ICmdObjRunner) *CmdObjBuilder { return &CmdObjBuilder{ runner: runner, |