diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2022-01-08 14:26:51 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2022-01-09 14:09:53 +1100 |
commit | 0dd1c12e2f9cdf67a17058bab220ba30f7e74ed4 (patch) | |
tree | 725ff4518f5cdf04f766096eb7526f30bce589af /pkg/gui | |
parent | 364c5db19cd8bc50f5142bcced1596a180b1499e (diff) |
fix format issue
Diffstat (limited to 'pkg/gui')
-rw-r--r-- | pkg/gui/status_panel.go | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/pkg/gui/status_panel.go b/pkg/gui/status_panel.go index 854ded536..444c32da1 100644 --- a/pkg/gui/status_panel.go +++ b/pkg/gui/status_panel.go @@ -28,8 +28,9 @@ func (gui *Gui) refreshStatus() { status += presentation.ColoredBranchStatus(currentBranch) + " " } - if gui.Git.Status.WorkingTreeState() != enums.REBASE_MODE_NONE { - status += style.FgYellow.Sprintf("(%s) ", gui.Git.Status.WorkingTreeState()) + workingTreeState := gui.Git.Status.WorkingTreeState() + if workingTreeState != enums.REBASE_MODE_NONE { + status += style.FgYellow.Sprintf("(%s) ", formatWorkingTreeState(workingTreeState)) } name := presentation.GetBranchTextStyle(currentBranch.Name).Sprint(currentBranch.Name) @@ -74,13 +75,7 @@ func (gui *Gui) handleStatusClick() error { workingTreeState := gui.Git.Status.WorkingTreeState() switch workingTreeState { case enums.REBASE_MODE_REBASING, enums.REBASE_MODE_MERGING: - var formattedState string - if workingTreeState == enums.REBASE_MODE_REBASING { - formattedState = "rebasing" - } else { - formattedState = "merging" - } - workingTreeStatus := fmt.Sprintf("(%s)", formattedState) + workingTreeStatus := fmt.Sprintf("(%s)", formatWorkingTreeState(workingTreeState)) if cursorInSubstring(cx, upstreamStatus+" ", workingTreeStatus) { return gui.handleCreateRebaseOptionsMenu() } @@ -96,6 +91,17 @@ func (gui *Gui) handleStatusClick() error { return nil } +func formatWorkingTreeState(rebaseMode enums.RebaseMode) string { + switch rebaseMode { + case enums.REBASE_MODE_REBASING: + return "rebasing" + case enums.REBASE_MODE_MERGING: + return "merging" + default: + return "none" + } +} + func (gui *Gui) statusRenderToMain() error { // TODO: move into some abstraction (status is currently not a listViewContext where a lot of this code lives) if gui.popupPanelFocused() { |