diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2021-04-02 19:20:40 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2021-04-06 19:34:32 +1000 |
commit | 798d3e2d54e828f25ed4aadcefff11593fa23e10 (patch) | |
tree | 3b68eedd78e13836da8d7b8c46c5862c458f02a0 | |
parent | e8f99c3326f543b713cafb6420a5b9c3c9b4d50c (diff) |
get rid of these positively ghastly method signatures
33 files changed, 351 insertions, 303 deletions
diff --git a/pkg/gui/branches_panel.go b/pkg/gui/branches_panel.go index e94ed7700..27c2d693c 100644 --- a/pkg/gui/branches_panel.go +++ b/pkg/gui/branches_panel.go @@ -4,7 +4,6 @@ import ( "fmt" "strings" - "github.com/jesseduffield/gocui" "github.com/jesseduffield/lazygit/pkg/commands" "github.com/jesseduffield/lazygit/pkg/commands/models" "github.com/jesseduffield/lazygit/pkg/gui/presentation" @@ -79,7 +78,7 @@ func (gui *Gui) refreshBranches() { // specific functions -func (gui *Gui) handleBranchPress(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleBranchPress() error { if gui.State.Panels.Branches.SelectedLineIdx == -1 { return nil } @@ -90,7 +89,7 @@ func (gui *Gui) handleBranchPress(g *gocui.Gui, v *gocui.View) error { return gui.handleCheckoutRef(branch.Name, handleCheckoutRefOptions{}) } -func (gui *Gui) handleCreatePullRequestPress(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleCreatePullRequestPress() error { pullRequest := commands.NewPullRequest(gui.GitCommand) branch := gui.getSelectedBranch() @@ -101,7 +100,7 @@ func (gui *Gui) handleCreatePullRequestPress(g *gocui.Gui, v *gocui.View) error return nil } -func (gui *Gui) handleCopyPullRequestURLPress(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleCopyPullRequestURLPress() error { pullRequest := commands.NewPullRequest(gui.GitCommand) branch := gui.getSelectedBranch() @@ -114,7 +113,7 @@ func (gui *Gui) handleCopyPullRequestURLPress(g *gocui.Gui, v *gocui.View) error return nil } -func (gui *Gui) handleGitFetch(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleGitFetch() error { if err := gui.createLoaderPanel(gui.Tr.FetchWait); err != nil { return err } @@ -126,7 +125,7 @@ func (gui *Gui) handleGitFetch(g *gocui.Gui, v *gocui.View) error { return nil } -func (gui *Gui) handleForceCheckout(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleForceCheckout() error { branch := gui.getSelectedBranch() message := gui.Tr.SureForceCheckout title := gui.Tr.ForceCheckoutBranch @@ -208,7 +207,7 @@ func (gui *Gui) handleCheckoutRef(ref string, options handleCheckoutRefOptions) }) } -func (gui *Gui) handleCheckoutByName(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleCheckoutByName() error { return gui.prompt(promptOpts{ title: gui.Tr.BranchName + ":", findSuggestionsFunc: gui.findBranchNameSuggestions, @@ -251,7 +250,7 @@ func (gui *Gui) createNewBranchWithName(newBranchName string) error { return gui.refreshSidePanels(refreshOptions{mode: ASYNC}) } -func (gui *Gui) handleDeleteBranch(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleDeleteBranch() error { return gui.deleteBranch(false) } @@ -328,7 +327,7 @@ func (gui *Gui) mergeBranchIntoCheckedOutBranch(branchName string) error { }) } -func (gui *Gui) handleMerge(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleMerge() error { if ok, err := gui.validateNotInFilterMode(); err != nil || !ok { return err } @@ -337,7 +336,7 @@ func (gui *Gui) handleMerge(g *gocui.Gui, v *gocui.View) error { return gui.mergeBranchIntoCheckedOutBranch(selectedBranchName) } -func (gui *Gui) handleRebaseOntoLocalBranch(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleRebaseOntoLocalBranch() error { selectedBranchName := gui.getSelectedBranch().Name return gui.handleRebaseOntoBranch(selectedBranchName) } @@ -369,7 +368,7 @@ func (gui *Gui) handleRebaseOntoBranch(selectedBranchName string) error { }) } -func (gui *Gui) handleFastForward(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleFastForward() error { branch := gui.getSelectedBranch() if branch == nil { return nil @@ -414,7 +413,7 @@ func (gui *Gui) handleFastForward(g *gocui.Gui, v *gocui.View) error { return nil } -func (gui *Gui) handleCreateResetToBranchMenu(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleCreateResetToBranchMenu() error { branch := gui.getSelectedBranch() if branch == nil { return nil @@ -423,7 +422,7 @@ func (gui *Gui) handleCreateResetToBranchMenu(g *gocui.Gui, v *gocui.View) error return gui.createResetMenu(branch.Name) } -func (gui *Gui) handleRenameBranch(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleRenameBranch() error { branch := gui.getSelectedBranch() if branch == nil { return nil diff --git a/pkg/gui/commit_files_panel.go b/pkg/gui/commit_files_panel.go index 1df42e41e..c72ee3b13 100644 --- a/pkg/gui/commit_files_panel.go +++ b/pkg/gui/commit_files_panel.go @@ -1,7 +1,6 @@ package gui import ( - "github.com/jesseduffield/gocui" "github.com/jesseduffield/lazygit/pkg/commands/models" "github.com/jesseduffield/lazygit/pkg/commands/patch" "github.com/jesseduffield/lazygit/pkg/gui/filetree" @@ -57,7 +56,7 @@ func (gui *Gui) handleCommitFileSelect() error { }) } -func (gui *Gui) handleCheckoutCommitFile(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleCheckoutCommitFile() error { node := gui.getSelectedCommitFileNode() if node == nil { return nil @@ -70,7 +69,7 @@ func (gui *Gui) handleCheckoutCommitFile(g *gocui.Gui, v *gocui.View) error { return gui.refreshSidePanels(refreshOptions{mode: ASYNC}) } -func (gui *Gui) handleDiscardOldFileChange(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleDiscardOldFileChange() error { if ok, err := gui.validateNormalWorkingTreeState(); !ok { return err } @@ -111,7 +110,7 @@ func (gui *Gui) refreshCommitFilesView() error { return gui.postRefreshUpdate(gui.Contexts.CommitFiles.Context) } -func (gui *Gui) handleOpenOldCommitFile(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleOpenOldCommitFile() error { node := gui.getSelectedCommitFileNode() if node == nil { return nil @@ -120,7 +119,7 @@ func (gui *Gui) handleOpenOldCommitFile(g *gocui.Gui, v *gocui.View) error { return gui.openFile(node.GetPath()) } -func (gui *Gui) handleEditCommitFile(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleEditCommitFile() error { node := gui.getSelectedCommitFileNode() if node == nil { return nil @@ -133,7 +132,7 @@ func (gui *Gui) handleEditCommitFile(g *gocui.Gui, v *gocui.View) error { return gui.editFile(node.GetPath()) } -func (gui *Gui) handleToggleFileForPatch(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleToggleFileForPatch() error { node := gui.getSelectedCommitFileNode() if node == nil { return nil @@ -195,7 +194,7 @@ func (gui *Gui) startPatchManager() error { return nil } -func (gui *Gui) handleEnterCommitFile(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleEnterCommitFile() error { return gui.enterCommitFile(-1) } diff --git a/pkg/gui/commit_message_panel.go b/pkg/gui/commit_message_panel.go index 1cdd51770..983d02af8 100644 --- a/pkg/gui/commit_message_panel.go +++ b/pkg/gui/commit_message_panel.go @@ -26,8 +26,9 @@ func (gui *Gui) runSyncOrAsyncCommand(sub *exec.Cmd, err error) (bool, error) { return true, nil } -func (gui *Gui) handleCommitConfirm(g *gocui.Gui, v *gocui.View) error { - message := gui.trimmedContent(v) +func (gui *Gui) handleCommitConfirm() error { + commitMessageView := gui.getCommitMessageView() + message := gui.trimmedContent(commitMessageView) if message == "" { return gui.createErrorPanel(gui.Tr.CommitWithoutMessageErr) } @@ -44,12 +45,12 @@ func (gui *Gui) handleCommitConfirm(g *gocui.Gui, v *gocui.View) error { return nil } - gui.clearEditorView(v) + gui.clearEditorView(commitMessageView) _ = gui.returnFromContext() return gui.refreshSidePanels(refreshOptions{mode: ASYNC}) } -func (gui *Gui) handleCommitClose(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleCommitClose() error { return gui.returnFromContext() } diff --git a/pkg/gui/commits_panel.go b/pkg/gui/commits_panel.go index 1ad295763..af4b9feed 100644 --- a/pkg/gui/commits_panel.go +++ b/pkg/gui/commits_panel.go @@ -3,7 +3,6 @@ package gui import ( "sync" - "github.com/jesseduffield/gocui" "github.com/jesseduffield/lazygit/pkg/commands" "github.com/jesseduffield/lazygit/pkg/commands/models" "github.com/jesseduffield/lazygit/pkg/utils" @@ -148,7 +147,7 @@ func (gui *Gui) refreshRebaseCommits() error { // specific functions -func (gui *Gui) handleCommitSquashDown(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleCommitSquashDown() error { if ok, err := gui.validateNotInFilterMode(); err != nil || !ok { return err } @@ -177,7 +176,7 @@ func (gui *Gui) handleCommitSquashDown(g *gocui.Gui, v *gocui.View) error { }) } -func (gui *Gui) handleCommitFixup(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleCommitFixup() error { if ok, err := gui.validateNotInFilterMode(); err != nil || !ok { return err } @@ -206,7 +205,7 @@ func (gui *Gui) handleCommitFixup(g *gocui.Gui, v *gocui.View) error { }) } -func (gui *Gui) handleRenameCommit(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleRenameCommit() error { if ok, err := gui.validateNotInFilterMode(); err != nil || !ok { return err } @@ -246,7 +245,7 @@ func (gui *Gui) handleRenameCommit(g *gocui.Gui, v *gocui.View) error { }) } -func (gui *Gui) handleRenameCommitEditor(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleRenameCommitEditor() error { if ok, err := gui.validateNotInFilterMode(); err != nil || !ok { return err } @@ -295,7 +294,7 @@ func (gui *Gui) handleMidRebaseCommand(action string) (bool, error) { return true, gui.refreshRebaseCommits() } -func (gui *Gui) handleCommitDelete(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleCommitDelete() error { if ok, err := gui.validateNotInFilterMode(); err != nil || !ok { return err } @@ -320,7 +319,7 @@ func (gui *Gui) handleCommitDelete(g *gocui.Gui, v *gocui.View) error { }) } -func (gui *Gui) handleCommitMoveDown(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleCommitMoveDown() error { if ok, err := gui.validateNotInFilterMode(); err != nil || !ok { return err } @@ -347,7 +346,7 @@ func (gui *Gui) handleCommitMoveDown(g *gocui.Gui, v *gocui.View) error { }) } -func (gui *Gui) handleCommitMoveUp(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleCommitMoveUp() error { if ok, err := gui.validateNotInFilterMode(); err != nil || !ok { return err } @@ -374,7 +373,7 @@ func (gui *Gui) handleCommitMoveUp(g *gocui.Gui, v *gocui.View) error { }) } -func (gui *Gui) handleCommitEdit(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleCommitEdit() error { if ok, err := gui.validateNotInFilterMode(); err != nil || !ok { return err } @@ -393,7 +392,7 @@ func (gui *Gui) handleCommitEdit(g *gocui.Gui, v *gocui.View) error { }) } -func (gui *Gui) handleCommitAmendTo(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleCommitAmendTo() error { if ok, err := gui.validateNotInFilterMode(); err != nil || !ok { return err } @@ -410,7 +409,7 @@ func (gui *Gui) handleCommitAmendTo(g *gocui.Gui, v *gocui.View) error { }) } -func (gui *Gui) handleCommitPick(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleCommitPick() error { if ok, err := gui.validateNotInFilterMode(); err != nil || !ok { return err } @@ -425,10 +424,10 @@ func (gui *Gui) handleCommitPick(g *gocui.Gui, v *gocui.View) error { // at this point we aren't actually rebasing so we will interpret this as an // attempt to pull. We might revoke this later after enabling configurable keybindings - return gui.handlePullFiles(g, v) + return gui.handlePullFiles() } -func (gui *Gui) handleCommitRevert(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleCommitRevert() error { if ok, err := gui.validateNotInFilterMode(); err != nil || !ok { return err } @@ -449,7 +448,7 @@ func (gui *Gui) handleViewCommitFiles() error { return gui.switchToCommitFilesContext(commit.Sha, true, gui.Contexts.BranchCommits.Context, "commits") } -func (gui *Gui) handleCreateFixupCommit(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleCreateFixupCommit() error { if ok, err := gui.validateNotInFilterMode(); err != nil || !ok { return err } @@ -479,7 +478,7 @@ func (gui *Gui) handleCreateFixupCommit(g *gocui.Gui, v *gocui.View) error { }) } -func (gui *Gui) handleSquashAllAboveFixupCommits(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleSquashAllAboveFixupCommits() error { if ok, err := gui.validateNotInFilterMode(); err != nil || !ok { return err } @@ -508,7 +507,7 @@ func (gui *Gui) handleSquashAllAboveFixupCommits(g *gocui.Gui, v *gocui.View) er }) } -func (gui *Gui) handleTagCommit(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleTagCommit() error { // TODO: bring up menu asking if you want to make a lightweight or annotated tag // if annotated, switch to a subprocess to create the message @@ -532,7 +531,7 @@ func (gui *Gui) handleCreateLightweightTag(commitSha string) error { }) } -func (gui *Gui) handleCheckoutCommit(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleCheckoutCommit() error { commit := gui.getSelectedLocalCommit() if commit == nil { return nil @@ -547,7 +546,7 @@ func (gui *Gui) handleCheckoutCommit(g *gocui.Gui, v *gocui.View) error { }) } -func (gui *Gui) handleCreateCommitResetMenu(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleCreateCommitResetMenu() error { commit := gui.getSelectedLocalCommit() if commit == nil { return gui.createErrorPanel(gui.Tr.NoCommitsThisBranch) @@ -556,7 +555,7 @@ func (gui *Gui) handleCreateCommitResetMenu(g *gocui.Gui, v *gocui.View) error { return gui.createResetMenu(commit.Sha) } -func (gui *Gui) handleOpenSearchForCommitsPanel(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleOpenSearchForCommitsPanel(_viewName string) error { // we usually lazyload these commits but now that we're searching we need to load them now if gui.State.Panels.Commits.LimitCommits { gui.State.Panels.Commits.LimitCommits = false @@ -565,10 +564,10 @@ func (gui *Gui) handleOpenSearchForCommitsPanel(g *gocui.Gui, v *gocui.View) err } } - return gui.handleOpenSearch(gui.g, v) + return gui.handleOpenSearch("commits") } -func (gui *Gui) handleGotoBottomForCommitsPanel(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleGotoBottomForCommitsPanel() error { // we usually lazyload these commits but now that we're searching we need to load them now if gui.State.Panels.Commits.LimitCommits { gui.State.Panels.Commits.LimitCommits = false @@ -579,7 +578,7 @@ func (gui *Gui) handleGotoBottomForCommitsPanel(g *gocui.Gui, v *gocui.View) err for _, context := range gui.getListContexts() { if context.ViewName == "commits" { - return context.handleGotoBottom(g, v) + return context.handleGotoBottom() } } diff --git a/pkg/gui/confirmation_panel.go b/pkg/gui/confirmation_panel.go index f21a3be71..74c4cc9d6 100644 --- a/pkg/gui/confirmation_panel.go +++ b/pkg/gui/confirmation_panel.go @@ -317,6 +317,12 @@ func (gui *Gui) setKeyBindings(opts createPopupPanelOpts) error { return nil } +func (gui *Gui) wrappedHandler(f func() error) func(g *gocui.Gui, v *gocui.View) error { + return func(g *gocui.Gui, v *gocui.View) error { + return f() + } +} + func (gui *Gui) createErrorPanel(message string) error { colorFunction := color.New(color.FgRed).SprintFunc() coloredMessage := colorFunction(strings.TrimSpace(message)) diff --git a/pkg/gui/credentials_panel.go b/pkg/gui/credentials_panel.go index fe97dc9aa..d79d4cf67 100644 --- a/pkg/gui/credentials_panel.go +++ b/pkg/gui/credentials_panel.go @@ -39,10 +39,11 @@ func (gui *Gui) promptUserForCredential(passOrUname string) string { return userInput + "\n" } -func (gui *Gui) handleSubmitCredential(g *gocui.Gui, v *gocui.View) error { - message := gui.trimmedContent(v) +func (gui *Gui) handleSubmitCredential() error { + credentialsView := gui.getCredentialsView() + message := gui.trimmedContent(credentialsView) gui.credentials <- message - gui.clearEditorView(v) + gui.clearEditorView(credentialsView) if err := gui.returnFromContext(); err != nil { return err } @@ -50,7 +51,7 @@ func (gui *Gui) handleSubmitCredential(g *gocui.Gui, v *gocui.View) error { return gui.refreshSidePanels(refreshOptions{}) } -func (gui *Gui) handleCloseCredentialsView(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleCloseCredentialsView() error { gui.credentials <- "" return gui.returnFromContext() } diff --git a/pkg/gui/custom_commands.go b/pkg/gui/custom_commands.go index d3fe62840..1411ec34f 100644 --- a/pkg/gui/custom_commands.go +++ b/pkg/gui/custom_commands.go @@ -198,7 +198,7 @@ func (gui *Gui) GetCustomCommandKeybindings() []*Binding { Contexts: contexts, Key: gui.getKey(customCommand.Key), Modifier: gocui.ModNone, - Handler: gui.wrappedHandler(gui.handleCustomCommandKeybinding(customCommand)), + Handler: gui.handleCustomCommandKeybinding(customCommand), Description: description, }) } diff --git a/pkg/gui/diffing.go b/pkg/gui/diffing.go index 408ae436f..5bce9fe44 100644 --- a/pkg/gui/diffing.go +++ b/pkg/gui/diffing.go @@ -3,8 +3,6 @@ package gui import ( "fmt" "strings" - - "github.com/jesseduffield/gocui" ) func (gui *Gui) exitDiffMode() error { @@ -102,7 +100,7 @@ func (gui *Gui) diffStr() string { return output } -func (gui *Gui) handleCreateDiffingMenuPanel(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleCreateDiffingMenuPanel() error { if gui.popupPanelFocused() { return nil } diff --git a/pkg/gui/files_panel.go b/pkg/gui/files_panel.go index f7edb2b25..2c9640f41 100644 --- a/pkg/gui/files_panel.go +++ b/pkg/gui/files_panel.go @@ -183,7 +183,7 @@ func (gui *Gui) stageSelectedFile() error { return gui.GitCommand.StageFile(file.Name) } -func (gui *Gui) handleEnterFile(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleEnterFile() error { return gui.enterFile(false, -1) } @@ -277,7 +277,7 @@ func (gui *Gui) focusAndSelectFile() error { return gui.selectFile(false) } -func (gui *Gui) handleStageAll(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleStageAll() error { var err error if gui.allFilesStaged() { err = gui.GitCommand.UnstageAll() @@ -350,7 +350,7 @@ func (gui *Gui) handleIgnoreFile() error { return gui.refreshSidePanels(refreshOptions{scope: []RefreshableView{FILES}}) } -func (gui *Gui) handleWIPCommitPress(g *gocui.Gui, filesView *gocui.View) error { +func (gui *Gui) handleWIPCommitPress() error { skipHookPreifx := gui.Config.GetUserConfig().Git.SkipHookPrefix if skipHookPreifx == "" { return gui.createErrorPanel(gui.Tr.SkipHookPrefixNotConfigured) @@ -500,7 +500,7 @@ func (gui *Gui) editFile(filename string) error { return err } -func (gui *Gui) handleFileEdit(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleFileEdit() error { node := gui.getSelectedFileNode() if node == nil { return nil @@ -513,7 +513,7 @@ func (gui *Gui) handleFileEdit(g *gocui.Gui, v *gocui.View) error { return gui.editFile(node.GetPath()) } -func (gui *Gui) handleFileOpen(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleFileOpen() error { node := gui.getSelectedFileNode() if node == nil { return nil @@ -522,7 +522,7 @@ func (gui *Gui) handleFileOpen(g *gocui.Gui, v *gocui.View) error { return gui.openFile(node.GetPath()) } -func (gui *Gui) handleRefreshFiles(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleRefreshFiles() error { return gui.refreshSidePanels(refreshOptions{scope: []RefreshableView{FILES}}) } @@ -615,7 +615,7 @@ func (gui *Gui) findNewSelectedIdx(prevNodes []*filetree.FileNode, currNodes []* return -1 } -func (gui *Gui) handlePullFiles(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handlePullFiles() error { if gui.popupPanelFocused() { return nil } @@ -706,7 +706,7 @@ func (gui *Gui) pullWithMode(mode string, opts PullFilesOptions) error { } } -func (gui *Gui) pushWithForceFlag(v *gocui.View, force bool, upstream string, args string) error { +func (gui *Gui) pushWithForceFlag(force bool, upstream string, args string) error { if err := gui.createLoaderPanel(gui.Tr.PushWait); err != nil { return err } @@ -723,7 +723,7 @@ func (gui *Gui) pushWithForceFlag(v *gocui.View, force bool, upstream string, ar title: gui.Tr.ForcePush, prompt: gui.Tr.ForcePushPrompt, handleConfirm: func() error { - return gui.pushWithForceFlag(v, true, upstream, args) + return gui.pushWithForceFlag(true, upstream, args) }, }) return @@ -734,7 +734,7 @@ func (gui *Gui) pushWithForceFlag(v *gocui.View, force bool, upstream string, ar return nil } -func (gui *Gui) pushFiles(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) pushFiles() error { if gui.popupPanelFocused() { return nil } @@ -750,23 +750,23 @@ func (gui *Gui) pushFiles(g *gocui.Gui, v *gocui.View) error { } for branchName, branch := range conf.Branches { if branchName == currentBranch.Name { - return gui.pushWithForceFlag(v, false, "", fmt.Sprintf("%s %s", branch.Remote, branchName)) + return gui.pushWithForceFlag(false, "", fmt.Sprintf("%s %s", branch.Remote, branchName)) } } if gui.GitCommand.PushToCurrent { - return gui.pushWithForceFlag(v, false, "", "--set-upstream") + return gui.pushWithForceFlag(false, "", "--set-upstream") } else { return gui.prompt(promptOpts{ title: gui.Tr.EnterUpstream, initialContent: "origin " + currentBranch.Name, handleConfirm: func(response string) error { - return gui.pushWithForceFlag(v, false, response, "") + return gui.pushWithForceFlag(false, response, "") }, }) } } else if currentBranch.Pullables == "0" { - return gui.pushWithForceFlag(v, false, "", "") + return gui.pushWithForceFlag(false, "", "") } forcePushDisabled := gui.Config.GetUserConfig().Git.DisableForcePushing @@ -778,7 +778,7 @@ func (gui *Gui) pushFiles(g *gocui.Gui, v *gocui.View) error { title: gui.Tr.ForcePush, prompt: gui.Tr.ForcePushPrompt, handleConfirm: func() error { - return gui.pushWithForceFlag(v, true, "", "") + return gui.pushWithForceFlag(true, "", "") }, }) } @@ -812,7 +812,7 @@ func (gui *Gui) anyFilesWithMergeConflicts() bool { return false } -func (gui *Gui) handleCustomCommand(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleCustomCommand() error { return gui.prompt(promptOpts{ title: gui.Tr.CustomCommand, handleConfirm: func(command string) error { @@ -822,7 +822,7 @@ func (gui *Gui) handleCustomCommand(g *gocui.Gui, v *gocui.View) error { }) } -func (gui *Gui) handleCreateStashMenu(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleCreateStashMenu() error { menuItems := []*menuItem{ { displayString: gui.Tr.LcStashAllChanges, @@ -841,11 +841,11 @@ func (gui *Gui) handleCreateStashMenu(g *gocui.Gui, v *gocui.View) error { return gui.createMenu(gui.Tr.LcStashOptions, menuItems, createMenuOptions{showCancel: true}) } -func (gui *Gui) handleStashChanges(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleStashChanges() error { return gui.handleStashSave(gui.GitCommand.StashSave) } -func (gui *Gui) handleCreateResetToUpstreamMenu(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleCreateResetToUpstreamMenu() error { return gui.createResetMenu("@{upstream}") } diff --git a/pkg/gui/filtering_menu_panel.go b/pkg/gui/filtering_menu_panel.go index ebebbd869..75c1e1c86 100644 --- a/pkg/gui/filtering_menu_panel.go +++ b/pkg/gui/filtering_menu_pan |