mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-11-29 22:48:24 +02:00
add support for git bisect
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package gui
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/jesseduffield/lazygit/pkg/commands/types/enums"
|
||||
"github.com/jesseduffield/lazygit/pkg/gui/style"
|
||||
)
|
||||
@@ -16,11 +18,13 @@ func (gui *Gui) modeStatuses() []modeStatus {
|
||||
{
|
||||
isActive: gui.State.Modes.Diffing.Active,
|
||||
description: func() string {
|
||||
return style.FgMagenta.Sprintf(
|
||||
"%s %s %s",
|
||||
gui.Tr.LcShowingGitDiff,
|
||||
"git diff "+gui.diffStr(),
|
||||
style.AttrUnderline.Sprint(gui.Tr.ResetInParentheses),
|
||||
return gui.withResetButton(
|
||||
fmt.Sprintf(
|
||||
"%s %s",
|
||||
gui.Tr.LcShowingGitDiff,
|
||||
"git diff "+gui.diffStr(),
|
||||
),
|
||||
style.FgMagenta,
|
||||
)
|
||||
},
|
||||
reset: gui.exitDiffMode,
|
||||
@@ -28,22 +32,20 @@ func (gui *Gui) modeStatuses() []modeStatus {
|
||||
{
|
||||
isActive: gui.Git.Patch.PatchManager.Active,
|
||||
description: func() string {
|
||||
return style.FgYellow.SetBold().Sprintf(
|
||||
"%s %s",
|
||||
gui.Tr.LcBuildingPatch,
|
||||
style.AttrUnderline.Sprint(gui.Tr.ResetInParentheses),
|
||||
)
|
||||
return gui.withResetButton(gui.Tr.LcBuildingPatch, style.FgYellow.SetBold())
|
||||
},
|
||||
reset: gui.handleResetPatch,
|
||||
},
|
||||
{
|
||||
isActive: gui.State.Modes.Filtering.Active,
|
||||
description: func() string {
|
||||
return style.FgRed.SetBold().Sprintf(
|
||||
"%s '%s' %s",
|
||||
gui.Tr.LcFilteringBy,
|
||||
gui.State.Modes.Filtering.GetPath(),
|
||||
style.AttrUnderline.Sprint(gui.Tr.ResetInParentheses),
|
||||
return gui.withResetButton(
|
||||
fmt.Sprintf(
|
||||
"%s '%s'",
|
||||
gui.Tr.LcFilteringBy,
|
||||
gui.State.Modes.Filtering.GetPath(),
|
||||
),
|
||||
style.FgRed,
|
||||
)
|
||||
},
|
||||
reset: gui.exitFilterMode,
|
||||
@@ -51,10 +53,12 @@ func (gui *Gui) modeStatuses() []modeStatus {
|
||||
{
|
||||
isActive: gui.State.Modes.CherryPicking.Active,
|
||||
description: func() string {
|
||||
return style.FgCyan.Sprintf(
|
||||
"%d commits copied %s",
|
||||
len(gui.State.Modes.CherryPicking.CherryPickedCommits),
|
||||
style.AttrUnderline.Sprint(gui.Tr.ResetInParentheses),
|
||||
return gui.withResetButton(
|
||||
fmt.Sprintf(
|
||||
"%d commits copied",
|
||||
len(gui.State.Modes.CherryPicking.CherryPickedCommits),
|
||||
),
|
||||
style.FgCyan,
|
||||
)
|
||||
},
|
||||
reset: gui.exitCherryPickingMode,
|
||||
@@ -65,13 +69,28 @@ func (gui *Gui) modeStatuses() []modeStatus {
|
||||
},
|
||||
description: func() string {
|
||||
workingTreeState := gui.Git.Status.WorkingTreeState()
|
||||
return style.FgYellow.Sprintf(
|
||||
"%s %s",
|
||||
formatWorkingTreeState(workingTreeState),
|
||||
style.AttrUnderline.Sprint(gui.Tr.ResetInParentheses),
|
||||
return gui.withResetButton(
|
||||
formatWorkingTreeState(workingTreeState), style.FgYellow,
|
||||
)
|
||||
},
|
||||
reset: gui.abortMergeOrRebaseWithConfirm,
|
||||
},
|
||||
{
|
||||
isActive: func() bool {
|
||||
return gui.State.BisectInfo.Started()
|
||||
},
|
||||
description: func() string {
|
||||
return gui.withResetButton("bisecting", style.FgGreen)
|
||||
},
|
||||
reset: gui.resetBisect,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (gui *Gui) withResetButton(content string, textStyle style.TextStyle) string {
|
||||
return textStyle.Sprintf(
|
||||
"%s %s",
|
||||
content,
|
||||
style.AttrUnderline.Sprint(gui.Tr.ResetInParentheses),
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user