mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-27 23:08:02 +02:00
reorder patch command options
This commit is contained in:
parent
0046e9c469
commit
61deaaddb7
@ -23,18 +23,25 @@ func (gui *Gui) handleCreatePatchOptionsMenu(g *gocui.Gui, v *gocui.View) error
|
|||||||
}
|
}
|
||||||
|
|
||||||
options := []*patchMenuOption{
|
options := []*patchMenuOption{
|
||||||
{displayName: "discard patch", function: gui.handleDeletePatchFromCommit},
|
{displayName: fmt.Sprintf("remove patch from original commit (%s)", gui.GitCommand.PatchManager.CommitSha), function: gui.handleDeletePatchFromCommit},
|
||||||
{displayName: "pull patch out into index", function: gui.handlePullPatchIntoWorkingTree},
|
{displayName: "pull patch out into index", function: gui.handlePullPatchIntoWorkingTree},
|
||||||
{displayName: "save patch to file"},
|
{displayName: "reset patch", function: gui.handleClearPatch},
|
||||||
{displayName: "clear patch", function: gui.handleClearPatch},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
selectedCommit := gui.getSelectedCommit(gui.g)
|
selectedCommit := gui.getSelectedCommit(gui.g)
|
||||||
if selectedCommit != nil && gui.GitCommand.PatchManager.CommitSha != selectedCommit.Sha {
|
if selectedCommit != nil && gui.GitCommand.PatchManager.CommitSha != selectedCommit.Sha {
|
||||||
options = append(options, &patchMenuOption{
|
// adding this option to index 1
|
||||||
displayName: fmt.Sprintf("move patch to selected commit (%s)", selectedCommit.Sha),
|
options = append(
|
||||||
function: gui.handleMovePatchToSelectedCommit,
|
options[:1],
|
||||||
})
|
append(
|
||||||
|
[]*patchMenuOption{
|
||||||
|
{
|
||||||
|
displayName: fmt.Sprintf("move patch to selected commit (%s)", selectedCommit.Sha),
|
||||||
|
function: gui.handleMovePatchToSelectedCommit,
|
||||||
|
},
|
||||||
|
}, options[1:]...,
|
||||||
|
)...,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
handleMenuPress := func(index int) error {
|
handleMenuPress := func(index int) error {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user