2020-09-29 11:10:57 +02:00
|
|
|
package oscommands
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/jesseduffield/lazygit/pkg/utils"
|
|
|
|
)
|
|
|
|
|
|
|
|
// NewDummyOSCommand creates a new dummy OSCommand for testing
|
|
|
|
func NewDummyOSCommand() *OSCommand {
|
2022-01-03 06:15:26 +02:00
|
|
|
osCmd := NewOSCommand(utils.NewDummyCommon(), dummyPlatform)
|
|
|
|
|
|
|
|
return osCmd
|
2020-09-29 11:10:57 +02:00
|
|
|
}
|
2021-12-30 04:11:58 +02:00
|
|
|
|
2021-12-30 08:19:01 +02:00
|
|
|
func NewDummyCmdObjBuilder(runner ICmdObjRunner) *CmdObjBuilder {
|
2021-12-30 04:11:58 +02:00
|
|
|
return &CmdObjBuilder{
|
|
|
|
runner: runner,
|
|
|
|
logCmdObj: func(ICmdObj) {},
|
2022-01-03 06:15:26 +02:00
|
|
|
platform: dummyPlatform,
|
2021-12-30 04:11:58 +02:00
|
|
|
}
|
|
|
|
}
|
2021-12-31 01:44:47 +02:00
|
|
|
|
2022-01-03 06:15:26 +02:00
|
|
|
var dummyPlatform = &Platform{
|
|
|
|
OS: "darwin",
|
|
|
|
Shell: "bash",
|
|
|
|
ShellArg: "-c",
|
|
|
|
OpenCommand: "open {{filename}}",
|
|
|
|
OpenLinkCommand: "open {{link}}",
|
|
|
|
}
|
|
|
|
|
2021-12-31 01:44:47 +02:00
|
|
|
func NewDummyOSCommandWithRunner(runner *FakeCmdObjRunner) *OSCommand {
|
2022-01-03 06:15:26 +02:00
|
|
|
osCommand := NewOSCommand(utils.NewDummyCommon(), dummyPlatform)
|
2021-12-31 01:44:47 +02:00
|
|
|
osCommand.Cmd = NewDummyCmdObjBuilder(runner)
|
|
|
|
|
|
|
|
return osCommand
|
|
|
|
}
|