2020-08-22 03:44:03 +02:00
|
|
|
package gui
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"github.com/fatih/color"
|
|
|
|
"github.com/jesseduffield/lazygit/pkg/utils"
|
|
|
|
)
|
|
|
|
|
|
|
|
type modeStatus struct {
|
|
|
|
isActive func() bool
|
|
|
|
description func() string
|
2020-08-23 01:23:59 +02:00
|
|
|
reset func() error
|
2020-08-22 03:44:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func (gui *Gui) modeStatuses() []modeStatus {
|
|
|
|
return []modeStatus{
|
|
|
|
{
|
|
|
|
isActive: gui.State.Modes.Diffing.Active,
|
|
|
|
description: func() string {
|
2020-08-23 01:23:59 +02:00
|
|
|
return utils.ColoredString(
|
2020-10-04 02:00:48 +02:00
|
|
|
fmt.Sprintf("%s %s %s", gui.Tr.LcShowingGitDiff, "git diff "+gui.diffStr(), utils.ColoredString(gui.Tr.ResetInParentheses, color.Underline)),
|
2020-08-23 01:23:59 +02:00
|
|
|
color.FgMagenta,
|
|
|
|
)
|
2020-08-22 03:44:03 +02:00
|
|
|
},
|
2020-08-23 01:23:59 +02:00
|
|
|
reset: gui.exitDiffMode,
|
2020-08-22 03:44:03 +02:00
|
|
|
},
|
|
|
|
{
|
2021-04-06 01:50:09 +02:00
|
|
|
isActive: gui.GitCommand.PatchManager.Active,
|
2020-08-22 03:44:03 +02:00
|
|
|
description: func() string {
|
2020-08-23 01:23:59 +02:00
|
|
|
return utils.ColoredString(
|
2021-04-06 01:50:09 +02:00
|
|
|
fmt.Sprintf("%s %s", gui.Tr.LcBuildingPatch, utils.ColoredString(gui.Tr.ResetInParentheses, color.Underline)),
|
|
|
|
color.FgYellow,
|
2020-08-23 01:23:59 +02:00
|
|
|
color.Bold,
|
|
|
|
)
|
2020-08-22 03:44:03 +02:00
|
|
|
},
|
2021-04-06 01:50:09 +02:00
|
|
|
reset: gui.handleResetPatch,
|
2020-08-22 03:44:03 +02:00
|
|
|
},
|
|
|
|
{
|
2021-04-06 01:50:09 +02:00
|
|
|
isActive: gui.State.Modes.Filtering.Active,
|
2020-08-22 03:44:03 +02:00
|
|
|
description: func() string {
|
2020-08-23 01:23:59 +02:00
|
|
|
return utils.ColoredString(
|
2021-04-06 01:50:09 +02:00
|
|
|
fmt.Sprintf("%s '%s' %s", gui.Tr.LcFilteringBy, gui.State.Modes.Filtering.GetPath(), utils.ColoredString(gui.Tr.ResetInParentheses, color.Underline)),
|
|
|
|
color.FgRed,
|
2020-08-23 01:23:59 +02:00
|
|
|
color.Bold,
|
|
|
|
)
|
2020-08-22 03:44:03 +02:00
|
|
|
},
|
2021-04-06 01:50:09 +02:00
|
|
|
reset: gui.exitFilterMode,
|
2020-08-22 03:44:03 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
isActive: gui.State.Modes.CherryPicking.Active,
|
|
|
|
description: func() string {
|
2020-08-23 01:23:59 +02:00
|
|
|
return utils.ColoredString(
|
2020-10-04 02:00:48 +02:00
|
|
|
fmt.Sprintf("%d commits copied %s", len(gui.State.Modes.CherryPicking.CherryPickedCommits), utils.ColoredString(gui.Tr.ResetInParentheses, color.Underline)),
|
2020-08-23 01:23:59 +02:00
|
|
|
color.FgCyan,
|
|
|
|
)
|
2020-08-22 03:44:03 +02:00
|
|
|
},
|
2020-08-23 01:23:59 +02:00
|
|
|
reset: gui.exitCherryPickingMode,
|
2020-08-22 03:44:03 +02:00
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|