summaryrefslogtreecommitdiffstats
path: root/pkg/gui
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/gui')
-rw-r--r--pkg/gui/branches_panel.go6
-rw-r--r--pkg/gui/commit_files_panel.go6
-rw-r--r--pkg/gui/commit_message_panel.go7
-rw-r--r--pkg/gui/commits_panel.go6
-rw-r--r--pkg/gui/custom_commands.go7
-rw-r--r--pkg/gui/diffing.go4
-rw-r--r--pkg/gui/files_panel.go26
-rw-r--r--pkg/gui/git_flow.go6
-rw-r--r--pkg/gui/gpg.go17
-rw-r--r--pkg/gui/gui.go8
-rw-r--r--pkg/gui/rebase_options_panel.go2
-rw-r--r--pkg/gui/recent_repos_panel.go4
-rw-r--r--pkg/gui/reflog_panel.go6
-rw-r--r--pkg/gui/remote_branches_panel.go6
-rw-r--r--pkg/gui/reset_menu_panel.go7
-rw-r--r--pkg/gui/stash_panel.go4
-rw-r--r--pkg/gui/sub_commits_panel.go6
-rw-r--r--pkg/gui/submodules_panel.go19
-rw-r--r--pkg/gui/tags_panel.go6
-rw-r--r--pkg/gui/undoing.go3
20 files changed, 71 insertions, 85 deletions
diff --git a/pkg/gui/branches_panel.go b/pkg/gui/branches_panel.go
index dee321979..7b712b2ba 100644
--- a/pkg/gui/branches_panel.go
+++ b/pkg/gui/branches_panel.go
@@ -32,11 +32,9 @@ func (gui *Gui) branchesRenderToMain() error {
if branch == nil {
task = NewRenderStringTask(gui.Tr.NoBranchesThisRepo)
} else {
- cmd := gui.OSCommand.ExecutableFromString(
- gui.GitCommand.GetBranchGraphCmdStr(branch.Name),
- )
+ cmdObj := gui.GitCommand.GetBranchGraphCmdObj(branch.Name)
- task = NewRunPtyTask(cmd)
+ task = NewRunPtyTask(cmdObj.GetCmd())
}
return gui.refreshMainViews(refreshMainOpts{
diff --git a/pkg/gui/commit_files_panel.go b/pkg/gui/commit_files_panel.go
index e89108e46..2b7e513df 100644
--- a/pkg/gui/commit_files_panel.go
+++ b/pkg/gui/commit_files_panel.go
@@ -45,10 +45,8 @@ func (gui *Gui) commitFilesRenderToMain() error {
to := gui.State.CommitFileManager.GetParent()
from, reverse := gui.getFromAndReverseArgsForDiff(to)
- cmd := gui.OSCommand.ExecutableFromString(
- gui.GitCommand.ShowFileDiffCmdStr(from, to, reverse, node.GetPath(), false),
- )
- task := NewRunPtyTask(cmd)
+ cmdObj := gui.GitCommand.ShowFileDiffCmdObj(from, to, reverse, node.GetPath(), false)
+ task := NewRunPtyTask(cmdObj.GetCmd())
return gui.refreshMainViews(refreshMainOpts{
main: &viewUpdateOpts{
diff --git a/pkg/gui/commit_message_panel.go b/pkg/gui/commit_message_panel.go
index b3c1d635a..9e74f26f9 100644
--- a/pkg/gui/commit_message_panel.go
+++ b/pkg/gui/commit_message_panel.go
@@ -24,10 +24,11 @@ func (gui *Gui) handleCommitConfirm() error {
flags = append(flags, "--signoff")
}
- cmdStr := gui.GitCommand.CommitCmdStr(message, strings.Join(flags, " "))
- gui.OnRunCommand(oscommands.NewCmdLogEntry(cmdStr, gui.Tr.Spans.Commit, true))
+ cmdObj := gui.GitCommand.CommitCmdObj(message, strings.Join(flags, " "))
+ gui.OnRunCommand(oscommands.NewCmdLogEntry(cmdObj.ToString(), gui.Tr.Spans.Commit, true))
+
_ = gui.returnFromContext()
- return gui.withGpgHandling(cmdStr, gui.Tr.CommittingStatus, func() error {
+ return gui.withGpgHandling(cmdObj, gui.Tr.CommittingStatus, func() error {
gui.Views.CommitMessage.ClearTextArea()
return nil
})
diff --git a/pkg/gui/commits_panel.go b/pkg/gui/commits_panel.go
index a606ce952..8f65ab56e 100644
--- a/pkg/gui/commits_panel.go
+++ b/pkg/gui/commits_panel.go
@@ -46,10 +46,8 @@ func (gui *Gui) branchCommitsRenderToMain() error {
if commit == nil {
task = NewRenderStringTask(gui.Tr.NoCommitsThisBranch)
} else {
- cmd := gui.OSCommand.ExecutableFromString(
- gui.GitCommand.ShowCmdStr(commit.Sha, gui.State.Modes.Filtering.GetPath()),
- )
- task = NewRunPtyTask(cmd)
+ cmdObj := gui.GitCommand.ShowCmdObj(commit.Sha, gui.State.Modes.Filtering.GetPath())
+ task = NewRunPtyTask(cmdObj.GetCmd())
}
return gui.refreshMainViews(refreshMainOpts{
diff --git a/pkg/gui/custom_commands.go b/pkg/gui/custom_commands.go
index 8f98d6597..06526b6f0 100644
--- a/pkg/gui/custom_commands.go
+++ b/pkg/gui/custom_commands.go
@@ -203,7 +203,7 @@ func (gui *Gui) menuPromptFromCommand(prompt config.CustomCommandPrompt, promptR
}
// Run and save output
- message, err := gui.GitCommand.RunCommandWithOutput(cmdStr)
+ message, err := gui.GitCommand.RunWithOutput(gui.GitCommand.NewCmdObj(cmdStr))
if err != nil {
return gui.surfaceError(err)
}
@@ -244,7 +244,7 @@ func (gui *Gui) handleCustomCommandKeybinding(customCommand config.CustomCommand
}
if customCommand.Subprocess {
- return gui.runSubprocessWithSuspenseAndRefresh(gui.OSCommand.PrepareShellSubProcess(cmdStr))
+ return gui.runSubprocessWithSuspenseAndRefresh(gui.OSCommand.NewShellCmdObjFromString2(cmdStr))
}
loadingText := customCommand.LoadingText
@@ -252,7 +252,8 @@ func (gui *Gui) handleCustomCommandKeybinding(customCommand config.CustomCommand
loadingText = gui.Tr.LcRunningCustomCommandStatus
}
return gui.WithWaitingStatus(loadingText, func() error {
- if err := gui.OSCommand.WithSpan(gui.Tr.Spans.CustomCommand).RunShellCommand(cmdStr); err != nil {
+ cmdObj := gui.OSCommand.NewShellCmdObjFromString(cmdStr)
+ if err := gui.OSCommand.WithSpan(gui.Tr.Spans.CustomCommand).Run(cmdObj); err != nil {
return gui.surfaceError(err)
}
return gui.refreshSidePanels(refreshOptions{})
diff --git a/pkg/gui/diffing.go b/pkg/gui/diffing.go
index e1f3afa88..8b54e21af 100644
--- a/pkg/gui/diffing.go
+++ b/pkg/gui/diffing.go
@@ -13,10 +13,10 @@ func (gui *Gui) exitDiffMode() error {
}
func (gui *Gui) renderDiff() error {
- cmd := gui.OSCommand.ExecutableFromString(
+ cmdObj := gui.OSCommand.NewCmdObj(
fmt.Sprintf("git diff --submodule --no-ext-diff --color %s", gui.diffStr()),
)
- task := NewRunPtyTask(cmd)
+ task := NewRunPtyTask(cmdObj.GetCmd())
return gui.refreshMainViews(refreshMainOpts{
main: &viewUpdateOpts{
diff --git a/pkg/gui/files_panel.go b/pkg/gui/files_panel.go
index a0e71bc20..91415e1a7 100644
--- a/pkg/gui/files_panel.go
+++ b/pkg/gui/files_panel.go
@@ -58,22 +58,20 @@ func (gui *Gui) filesRenderToMain() error {
return gui.refreshMergePanelWithLock()
}
- cmdStr := gui.GitCommand.WorktreeFileDiffCmdStr(node, false, !node.GetHasUnstagedChanges() && node.GetHasStagedChanges(), gui.State.IgnoreWhitespaceInDiffView)
- cmd := gui.OSCommand.ExecutableFromString(cmdStr)
+ cmdObj := gui.GitCommand.WorktreeFileDiffCmdObj(node, false, !node.GetHasUnstagedChanges() && node.GetHasStagedChanges(), gui.State.IgnoreWhitespaceInDiffView)
refreshOpts := refreshMainOpts{main: &viewUpdateOpts{
title: gui.Tr.UnstagedChanges,
- task: NewRunPtyTask(cmd),
+ task: NewRunPtyTask(cmdObj.GetCmd()),
}}
if node.GetHasUnstagedChanges() {
if node.GetHasStagedChanges() {
- cmdStr := gui.GitCommand.WorktreeFileDiffCmdStr(node, false, true, gui.State.IgnoreWhitespaceInDiffView)
- cmd := gui.OSCommand.ExecutableFromString(cmdStr)
+ cmdObj := gui.GitCommand.WorktreeFileDiffCmdObj(node, false, true, gui.State.IgnoreWhitespaceInDiffView)
refreshOpts.secondary = &viewUpdateOpts{
title: gui.Tr.StagedChanges,
- task: NewRunPtyTask(cmd),
+ task: NewRunPtyTask(cmdObj.GetCmd()),
}
}
} else {
@@ -440,9 +438,9 @@ func (gui *Gui) handleAmendCommitPress() error {
title: strings.Title(gui.Tr.AmendLastCommit),
prompt: gui.Tr.SureToAmend,
handleConfirm: func() error {
- cmdStr := gui.GitCommand.AmendHeadCmdStr()
- gui.OnRunCommand(oscommands.NewCmdLogEntry(cmdStr, gui.Tr.Spans.AmendCommit, true))
- return gui.withGpgHandling(cmdStr, gui.Tr.AmendingStatus, nil)
+ cmdObj := gui.GitCommand.AmendHeadCmdObj()
+ gui.OnRunCommand(oscommands.NewCmdLogEntry(cmdObj.ToString(), gui.Tr.Spans.AmendCommit, true))
+ return gui.withGpgHandling(cmdObj, gui.Tr.AmendingStatus, nil)
},
})
}
@@ -464,8 +462,10 @@ func (gui *Gui) handleCommitEditorPress() error {
args = append(args, "--signoff")
}
+ cmdStr := "git " + strings.Join(args, " ")
+
return gui.runSubprocessWithSuspenseAndRefresh(
- gui.OSCommand.WithSpan(gui.Tr.Spans.Commit).PrepareSubProcess("git", args...),
+ gui.GitCommand.WithSpan(gui.Tr.Spans.Commit).NewCmdObjWithLog(cmdStr),
)
}
@@ -511,7 +511,7 @@ func (gui *Gui) editFileAtLine(filename string, lineNumber int) error {
}
return gui.runSubprocessWithSuspenseAndRefresh(
- gui.OSCommand.WithSpan(gui.Tr.Spans.EditFile).ShellCommandFromString(cmdStr),
+ gui.OSCommand.WithSpan(gui.Tr.Spans.EditFile).NewShellCmdObjFromString(cmdStr),
)
}
@@ -923,7 +923,7 @@ func (gui *Gui) handleCustomCommand() error {
gui.OnRunCommand(oscommands.NewCmdLogEntry(command, gui.Tr.Spans.CustomCommand, true))
return gui.runSubprocessWithSuspenseAndRefresh(
- gui.OSCommand.PrepareShellSubProcess(command),
+ gui.OSCommand.NewShellCmdObjFromString2(command),
)
},
})
@@ -1004,7 +1004,7 @@ func (gui *Gui) handleOpenMergeTool() error {
prompt: gui.Tr.MergeToolPrompt,
handleConfirm: func() error {
return gui.runSubprocessWithSuspenseAndRefresh(
- gui.OSCommand.ExecutableFromString(gui.GitCommand.OpenMergeToolCmd()),
+ gui.GitCommand.OpenMergeToolCmdObj(),
)
},
})
diff --git a/pkg/gui/git_flow.go b/pkg/gui/git_flow.go
index 31c64385b..29e0b2335 100644
--- a/pkg/gui/git_flow.go
+++ b/pkg/gui/git_flow.go
@@ -32,7 +32,7 @@ func (gui *Gui) gitFlowFinishBranch(gitFlowConfig string, branchName string) err
}
return gui.runSubprocessWithSuspenseAndRefresh(
- gui.OSCommand.WithSpan(gui.Tr.Spans.GitFlowFinish).PrepareSubProcess("git", "flow", branchType, "finish", suffix),
+ gui.GitCommand.WithSpan(gui.Tr.Spans.GitFlowFinish).NewCmdObjWithLog("git flow " + branchType + " finish " + suffix),
)
}
@@ -43,7 +43,7 @@ func (gui *Gui) handleCreateGitFlowMenu() error {
}
// get config
- gitFlowConfig, err := gui.GitCommand.RunCommandWithOutput("git config --local --get-regexp gitflow")
+ gitFlowConfig, err := gui.GitCommand.RunWithOutput(gui.GitCommand.NewCmdObj("git config --local --get-regexp gitflow"))
if err != nil {
return gui.createErrorPanel("You need to install git-flow and enable it in this repo to use git-flow features")
}
@@ -56,7 +56,7 @@ func (gui *Gui) handleCreateGitFlowMenu() error {
title: title,
handleConfirm: func(name string) error {
return gui.runSubprocessWithSuspenseAndRefresh(
- gui.OSCommand.WithSpan(gui.Tr.Spans.GitFlowStart).PrepareSubProcess("git", "flow", branchType, "start", name),
+ gui.GitCommand.WithSpan(gui.Tr.Spans.GitFlowStart).NewCmdObjWithLog("git flow " + branchType + " start " + name),
)
},
})
diff --git a/pkg/gui/gpg.go b/pkg/gui/gpg.go
index 1811e4fb5..9bd8b5d15 100644
--- a/pkg/gui/gpg.go
+++ b/pkg/gui/gpg.go
@@ -3,6 +3,7 @@ package gui
import (
"fmt"
+ "github.com/jesseduffield/lazygit/pkg/commands/oscommands"
"github.com/jesseduffield/lazygit/pkg/gui/style"
)
@@ -10,12 +11,11 @@ import (
// WithWaitingStatus we get stuck there and can't return to lazygit. We could
// fix this bug, or just stop running subprocesses from within there, given that
// we don't need to see a loading status if we're in a subprocess.
-func (gui *Gui) withGpgHandling(cmdStr string, waitingStatus string, onSuccess func() error) error {
+// TODO: work out if we actually need to use a shell command here
+func (gui *Gui) withGpgHandling(cmdObj oscommands.ICmdObj, waitingStatus string, onSuccess func() error) error {
useSubprocess := gui.GitCommand.UsingGpg()
if useSubprocess {
- // Need to remember why we use the shell for the subprocess but not in the other case
- // Maybe there's no good reason
- success, err := gui.runSubprocessWithSuspense(gui.OSCommand.ShellCommandFromString(cmdStr))
+ success, err := gui.runSubprocessWithSuspense(gui.OSCommand.NewShellCmdObjFromString(cmdObj.ToString()))
if success && onSuccess != nil {
if err := onSuccess(); err != nil {
return err
@@ -27,15 +27,16 @@ func (gui *Gui) withGpgHandling(cmdStr string, waitingStatus string, onSuccess f
return err
} else {
- return gui.RunAndStream(cmdStr, waitingStatus, onSuccess)
+ return gui.RunAndStream(cmdObj, waitingStatus, onSuccess)
}
}
-func (gui *Gui) RunAndStream(cmdStr string, waitingStatus string, onSuccess func() error) error {
+func (gui *Gui) RunAndStream(cmdObj oscommands.ICmdObj, waitingStatus string, onSuccess func() error) error {
return gui.WithWaitingStatus(waitingStatus, func() error {
- cmd := gui.OSCommand.ShellCommandFromString(cmdStr)
- cmd.Env = append(cmd.Env, "TERM=dumb")
+ cmdObj := gui.OSCommand.NewShellCmdObjFromString(cmdObj.ToString())
+ cmdObj.AddEnvVars("TERM=dumb")
cmdWriter := gui.getCmdWriter()
+ cmd := cmdObj.GetCmd()
cmd.Stdout = cmdWriter
cmd.Stderr = cmdWriter
diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go
index 4a2248935..39d2a9763 100644
--- a/pkg/gui/gui.go
+++ b/pkg/gui/gui.go
@@ -7,7 +7,6 @@ import (
"os"
"sync"
- "os/exec"
"strings"
"time"
@@ -578,7 +577,7 @@ func (gui *Gui) RunAndHandleError() error {
}
// returns whether command exited without error or not
-func (gui *Gui) runSubprocessWithSuspenseAndRefresh(subprocess *exec.Cmd) error {
+func (gui *Gui) runSubprocessWithSuspenseAndRefresh(subprocess oscommands.ICmdObj) error {
_, err := gui.runSubprocessWithSuspense(subprocess)
if err != nil {
return err
@@ -592,7 +591,7 @@ func (gui *Gui) runSubprocessWithSuspenseAndRefresh(subprocess *exec.Cmd) error
}
// returns whether command exited without error or not
-func (gui *Gui) runSubprocessWithSuspense(subprocess *exec.Cmd) (bool, error) {
+func (gui *Gui) runSubprocessWithSuspense(subprocess oscommands.ICmdObj) (bool, error) {
gui.Mutexes.SubprocessMutex.Lock()
defer gui.Mutexes.SubprocessMutex.Unlock()
@@ -621,7 +620,8 @@ func (gui *Gui) runSubprocessWithSuspense(subprocess *exec.Cmd) (bool, error) {
return cmdErr == nil, gui.surfaceError(cmdErr)
}
-func (gui *Gui) runSubprocess(subprocess *exec.Cmd) error {
+func (gui *Gui) runSubprocess(cmdObj oscommands.ICmdObj) error {
+ subprocess := cmdObj.GetCmd()
subprocess.Stdout = os.Stdout
subprocess.Stderr = os.Stdout
subprocess.Stdin = os.Stdin
diff --git a/pkg/gui/rebase_options_panel.go b/pkg/gui/rebase_options_panel.go
index 280022000..28241e57e 100644
--- a/pkg/gui/rebase_options_panel.go
+++ b/pkg/gui/rebase_options_panel.go
@@ -58,7 +58,7 @@ func (gui *Gui) genericMergeCommand(command string) error {
// it's impossible for a rebase to require a commit so we'll use a subprocess only if it's a merge
if status == commands.REBASE_MODE_MERGING && command != REBASE_OPTION_ABORT && gui.Config.GetUserConfig().Git.Merging.ManualCommit {
- sub := gitCommand.OSCommand.PrepareSubProcess("git", commandType, fmt.Sprintf("--%s", command))
+ sub := gitCommand.NewCmdObj("git " + commandType + " --" + command)
if sub != nil {
return gui.runSubprocessWithSuspenseAndRefresh(sub)
}
diff --git a/pkg/gui/recent_repos_panel.go b/pkg/gui/recent_repos_panel.go
index 5460a2155..ae5d35948 100644
--- a/pkg/gui/recent_repos_panel.go
+++ b/pkg/gui/recent_repos_panel.go
@@ -38,10 +38,10 @@ func (gui *Gui) handleCreateRecentReposMenu() error {
}
func (gui *Gui) handleShowAllBranchLogs() error {
- cmd := gui.OSCommand.ExecutableFromString(
+ cmdObj := gui.OSCommand.NewCmdObj(
gui.Config.GetUserConfig().Git.AllBranchesLogCmd,
)
- task := NewRunPtyTask(cmd)
+ task := NewRunPtyTask(cmdObj.GetCmd())
return gui.refreshMainViews(refreshMainOpts{
main: &viewUpdateOpts{
diff --git a/pkg/gui/reflog_panel.go b/pkg/gui/reflog_panel.go
index a5f1d2614..9df0d2501 100644
--- a/pkg/gui/reflog_panel.go
+++ b/pkg/gui/reflog_panel.go
@@ -22,11 +22,9 @@ func (gui *Gui) reflogCommitsRenderToMain() error {
if commit == nil {
task = NewRenderStringTask("No reflog history")
} else {
- cmd := gui.OSCommand.ExecutableFromString(
- gui.GitCommand.ShowCmdStr(commit.Sha, gui.State.Modes.Filtering.GetPath()),
- )
+ cmdObj := gui.GitCommand.ShowCmdObj(commit.Sha, gui.State.Modes.Filtering.GetPath())
- task = NewRunPtyTask(cmd)
+ task = NewRunPtyTask(cmdObj.GetCmd())
}
return gui.refreshMainViews(refreshMainOpts{
diff --git a/pkg/gui/remote_branches_panel.go b/pkg/gui/remote_branches_panel.go
index eba2e5d2b..a18479281 100644
--- a/pkg/gui/remote_branches_panel.go
+++ b/pkg/gui/remote_branches_panel.go
@@ -24,10 +24,8 @@ func (gui *Gui) remoteBranchesRenderToMain() error {
if remoteBranch == nil {
task = NewRenderStringTask("No branches for this remote")
} else {
- cmd := gui.OSCommand.ExecutableFromString(
- gui.GitCommand.GetBranchGraphCmdStr(remoteBranch.FullName()),
- )
- task = NewRunCommandTask(cmd)
+ cmdObj := gui.GitCommand.GetBranchGraphCmdObj(remoteBranch.FullName())
+ task = NewRunCommandTask(cmdObj.GetCmd())
}
return gui.refreshMainViews(refreshMainOpts{
diff --git a/pkg/gui/reset_menu_panel.go b/pkg/gui/reset_menu_panel.go
index fc15d36de..609655571 100644
--- a/pkg/gui/reset_menu_panel.go
+++ b/pkg/gui/reset_menu_panel.go
@@ -3,12 +3,11 @@ package gui
import (
"fmt"
- "github.com/jesseduffield/lazygit/pkg/commands/oscommands"
"github.com/jesseduffield/lazygit/pkg/gui/style"
)
-func (gui *Gui) resetToRef(ref string, strength string, span string, options oscommands.RunCommandOptions) error {
- if err := gui.GitCommand.WithSpan(span).ResetToCommit(ref, strength, options); err != nil {
+func (gui *Gui) resetToRef(ref string, strength string, span string, envVars []string) error {
+ if err := gui.GitCommand.WithSpan(span).ResetToCommit(ref, strength, envVars); err != nil {
return gui.surfaceError(err)
}
@@ -39,7 +38,7 @@ func (gui *Gui) createResetMenu(ref string) error {
style.FgRed.Sprintf("reset --%s %s", strength, ref),
},
onPress: func() error {
- return gui.resetToRef(ref, strength, "Reset", oscommands.RunCommandOptions{})
+ return gui.resetToRef(ref, strength, "Reset", []string{})
},
}
}
diff --git a/pkg/gui/stash_panel.go b/pkg/gui/stash_panel.go
index 61dd6afd8..13837a502 100644
--- a/pkg/gui/stash_panel.go
+++ b/pkg/gui/stash_panel.go
@@ -22,10 +22,10 @@ func (gui *Gui) stashRenderToMain() error {
if stashEntry == nil {
task = NewRenderStringTask(gui.Tr.NoStashEntries)
} else {
- cmd := gui.OSCommand.ExecutableFromString(
+ cmdObj := gui.OSCommand.NewCmdObj(
gui.GitCommand.ShowStashEntryCmdStr(stashEntry.Index),
)
- task = NewRunPtyTask(cmd)
+ task = NewRunPtyTask(cmdObj.GetCmd())
}
return gui.refreshMainViews(refreshMainOpts{
diff --git a/pkg/gui/sub_commits_panel.go b/pkg/gui/sub_commits_panel.go
index a60767eea..fe2d24c40 100644
--- a/pkg/gui/sub_commits_panel.go
+++ b/pkg/gui/sub_commits_panel.go
@@ -23,11 +23,9 @@ func (gui *Gui) subCommitsRenderToMain() error {
if commit == nil {
task = NewRenderStringTask("No commits")
} else {
- cmd := gui.OSCommand.ExecutableFromString(
- gui.GitCommand.ShowCmdStr(commit.Sha, gui.State.Modes.Filtering.GetPath()),
- )
+ cmdObj := gui.GitCommand.ShowCmdObj(commit.Sha, gui.State.Modes.Filtering.GetPath())
- task = NewRunPtyTask(cmd)
+ task = NewRunPtyTask(cmdObj.GetCmd())
}
return gui.refreshMainViews(refreshMainOpts{
diff --git a/pkg/gui/submodules_panel.go b/pkg/gui/submodules_panel.go
index 4dd6aa628..01cd130e0 100644
--- a/pkg/gui/submodules_panel.go
+++ b/pkg/gui/submodules_panel.go
@@ -36,9 +36,8 @@ func (gui *Gui) submodulesRenderToMain() error {
if file == nil {
task = NewRenderStringTask(prefix)
} else {
- cmdStr := gui.GitCommand.WorktreeFileDiffCmdStr(file, false, !file.HasUnstagedChanges && file.HasStagedChanges, gui.State.IgnoreWhitespaceInDiffView)
- cmd := gui.OSCommand.ExecutableFromString(cmdStr)
- task = NewRunCommandTaskWithPrefix(cmd, prefix)
+ cmdObj := gui.GitCommand.WorktreeFileDiffCmdObj(file, false, !file.HasUnstagedChanges && file.HasStagedChanges, gui.State.IgnoreWhitespaceInDiffView)
+ task = NewRunCommandTaskWithPrefix(cmdObj.GetCmd(), prefix)
}
}
@@ -212,10 +211,10 @@ func (gui *Gui) handleResetRemoveSubmodule(submodule *models.SubmoduleConfig) er
func (gui *Gui) handleBulkSubmoduleActionsMenu() error {
menuItems := []*menuItem{
{
- displayStrings: []string{gui.Tr.LcBulkInitSubmodules, style.FgGreen.Sprint(gui.GitCommand.SubmoduleBulkInitCmdStr())},
+ displayStrings: []string{gui.Tr.LcBulkInitSubmodules, style.FgGreen.Sprint(gui.GitCommand.SubmoduleBulkInitCmdObj().ToString())},
onPress: func() error {
return gui.WithWaitingStatus(gui.Tr.LcRunningCommand, func() error {
- if err := gui.OSCommand.WithSpan(gui.Tr.Spans.BulkInitialiseSubmodules).RunCommand(gui.GitCommand.SubmoduleBulkInitCmdStr()); err != nil {
+ if err := gui.OSCommand.WithSpan(gui.Tr.Spans.BulkInitialiseSubmodules).Run(gui.GitCommand.SubmoduleBulkInitCmdObj()); err != nil {
return gui.surfaceError(err)
}
@@ -224,10 +223,10 @@ func (gui *Gui) handleBulkSubmoduleActionsMenu() error {
},
},
{
- displayStrings: []string{gui.Tr.LcBulkUpdateSubmodules, style.FgYellow.Sprint(gui.GitCommand.SubmoduleBulkUpdateCmdStr())},
+ displayStrings: []string{gui.Tr.LcBulkUpdateSubmodules, style.FgYellow.Sprint(gui.GitCommand.SubmoduleBulkUpdateCmdObj().ToString())},
onPress: func() error {
return gui.WithWaitingStatus(gui.Tr.LcRunningCommand, func() error {
- if err := gui.OSCommand.WithSpan(gui.Tr.Spans.BulkUpdateSubmodules).RunCommand(gui.GitCommand.SubmoduleBulkUpdateCmdStr()); err != nil {
+ if err := gui.OSCommand.WithSpan(gui.Tr.Spans.BulkUpdateSubmodules).Run(gui.GitCommand.SubmoduleBulkUpdateCmdObj()); err != nil {
return gui.surfaceError(err)
}
@@ -236,7 +235,7 @@ func (gui *Gui) handleBulkSubmoduleActionsMenu() error {
},
},
{
- displayStrings: []string{gui.Tr.LcSubmoduleStashAndReset, style.FgRed.Sprintf("git stash in each submodule && %s", gui.GitCommand.SubmoduleForceBulkUpdateCmdStr())},
+ displayStrings: []string{gui.Tr.LcSubmoduleStashAndReset, style.FgRed.Sprintf("git stash in each submodule && %s", gui.GitCommand.SubmoduleForceBulkUpdateCmdObj().ToString())},
onPress: func() error {
return gui.WithWaitingStatus(gui.Tr.LcRunningCommand, func() error {
if err := gui.GitCommand.WithSpan(gui.Tr.Spans.BulkStashAndResetSubmodules).ResetSubmodules(gui.State.Submodules); err != nil {
@@ -248,10 +247,10 @@ func (gui *Gui) handleBulkSubmoduleActionsMenu() error {
},
},
{
- displayStrings: []string{gui.Tr.LcBulkDeinitSubmodules, style.FgRed.Sprint(gui.GitCommand.SubmoduleBulkDeinitCmdStr())},
+ displayStrings: []string{gui.Tr.LcBulkDeinitSubmodules, style.FgRed.Sprint(gui.GitCommand.SubmoduleBulkDeinitCmdObj().ToString())},
onPress: func() error {
return gui.WithWaitingStatus(gui.Tr.LcRunningCommand, func() error {
- if err := gui.OSCommand.WithSpan(gui.Tr.Spans.BulkDeinitialiseSubmodules).RunCommand(gui.GitCommand.SubmoduleBulkDeinitCmdStr()); err != nil {
+ if err := gui.OSCommand.WithSpan(gui.Tr.Spans.BulkDeinitialiseSubmodules).Run(gui.GitCommand.SubmoduleBulkDeinitCmdObj()); err != nil {
return gui.surfaceError(err)
}
diff --git a/pkg/gui/tags_panel.go b/pkg/gui/tags_panel.go
index b747c7e1a..51790fd58 100644
--- a/pkg/gui/tags_panel.go
+++ b/pkg/gui/tags_panel.go
@@ -25,10 +25,8 @@ func (gui *Gui) tagsRenderToMain() error {
if tag == nil {
task = NewRenderStringTask("No tags")
} else {
- cmd := gui.OSCommand.ExecutableFromString(
- gui.GitCommand.GetBranchGraphCmdStr(tag.Name),
- )
- task = NewRunCommandTask(cmd)
+ cmdObj := gui.GitCommand.GetBranchGraphCmdObj(tag.Name)
+ task = NewRunCommandTask(cmdObj.GetCmd())
}
return gui.refreshMainViews(refreshMainOpts{
diff --git a/pkg/gui/undoing.go b/pkg/gui/undoing.go
index bd67408d4..76a391730 100644
--- a/pkg/gui/undoing.go
+++ b/pkg/gui/undoing.go
@@ -2,7 +2,6 @@ package gui
import (
"github.com/jesseduffield/lazygit/pkg/commands"
- "github.com/jesseduffield/lazygit/pkg/commands/oscommands"
"github.com/jesseduffield/lazygit/pkg/utils"
)
@@ -169,7 +168,7 @@ func (gui *Gui) handleHardResetWithAutoStash(commitSha string, options handleHar
gitCommand := gui.GitCommand.WithSpan(options.span)
reset := func() error {
- if err := gui.resetToRef(commitSha, "hard", options.span, oscommands.RunCommandOptions{EnvVars: options.EnvVars}); err != nil {
+ if err := gui.resetToRef(commitSha, "hard", options.span, options.EnvVars); err != nil {
return gui.surfaceError(err)
}
return nil