1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-12-04 10:34:55 +02:00
lazygit/pkg/gui/modes.go

62 lines
1.6 KiB
Go
Raw Normal View History

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
}
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-23 01:23:59 +02:00
reset: gui.exitDiffMode,
},
{
isActive: gui.GitCommand.PatchManager.Active,
description: func() string {
2020-08-23 01:23:59 +02:00
return utils.ColoredString(
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,
)
},
reset: gui.handleResetPatch,
},
{
isActive: gui.State.Modes.Filtering.Active,
description: func() string {
2020-08-23 01:23:59 +02:00
return utils.ColoredString(
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,
)
},
reset: gui.exitFilterMode,
},
{
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-23 01:23:59 +02:00
reset: gui.exitCherryPickingMode,
},
}
}