mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 04:15:48 +02:00
start breaking up git struct
This commit is contained in:
parent
4a1d23dc27
commit
f503ff1ecb
76 changed files with 2234 additions and 1758 deletions
|
@ -20,7 +20,7 @@ import (
|
|||
type OSCommand struct {
|
||||
*common.Common
|
||||
Platform *Platform
|
||||
Getenv func(string) string
|
||||
GetenvFn func(string) string
|
||||
|
||||
// callback to run before running a command, i.e. for the purposes of logging.
|
||||
// the string argument is the command string e.g. 'git add .' and the bool is
|
||||
|
@ -43,24 +43,20 @@ type Platform struct {
|
|||
}
|
||||
|
||||
// NewOSCommand os command runner
|
||||
func NewOSCommand(common *common.Common, platform *Platform) *OSCommand {
|
||||
func NewOSCommand(common *common.Common, platform *Platform, guiIO *guiIO) *OSCommand {
|
||||
c := &OSCommand{
|
||||
Common: common,
|
||||
Platform: platform,
|
||||
Getenv: os.Getenv,
|
||||
GetenvFn: os.Getenv,
|
||||
removeFile: os.RemoveAll,
|
||||
}
|
||||
|
||||
runner := &cmdObjRunner{log: common.Log, logCmdObj: c.LogCmdObj}
|
||||
runner := &cmdObjRunner{log: common.Log, guiIO: guiIO}
|
||||
c.Cmd = &CmdObjBuilder{runner: runner, platform: platform}
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
func (c *OSCommand) LogCmdObj(cmdObj ICmdObj) {
|
||||
c.LogCommand(cmdObj.ToString(), true)
|
||||
}
|
||||
|
||||
func (c *OSCommand) LogCommand(cmdStr string, commandLine bool) {
|
||||
c.Log.WithField("command", cmdStr).Info("RunCommand")
|
||||
|
||||
|
@ -270,6 +266,10 @@ func (c *OSCommand) RemoveFile(path string) error {
|
|||
return c.removeFile(path)
|
||||
}
|
||||
|
||||
func (c *OSCommand) Getenv(key string) string {
|
||||
return c.GetenvFn(key)
|
||||
}
|
||||
|
||||
func GetTempDir() string {
|
||||
return filepath.Join(os.TempDir(), "lazygit")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue