summaryrefslogtreecommitdiffstats
path: root/pkg/gui/presentation
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2023-07-28 16:17:15 +1000
committerJesse Duffield <jessedduffield@gmail.com>2023-07-30 18:35:24 +1000
commitde57cfd6ff17751f7243476441beab6486fb4381 (patch)
tree91f028b12eb403a2ae2e0e5c0460cdc548958a86 /pkg/gui/presentation
parent2b24c15938c5ceb29a9b2d525aa1318b8bc8a87b (diff)
Remove IO logic from presentation code for worktrees
We're doing all the IO in our workers loader method so that we don't need to do any in our presentation code
Diffstat (limited to 'pkg/gui/presentation')
-rw-r--r--pkg/gui/presentation/worktrees.go12
1 files changed, 5 insertions, 7 deletions
diff --git a/pkg/gui/presentation/worktrees.go b/pkg/gui/presentation/worktrees.go
index 6c8acf976..c16871c69 100644
--- a/pkg/gui/presentation/worktrees.go
+++ b/pkg/gui/presentation/worktrees.go
@@ -9,28 +9,26 @@ import (
"github.com/samber/lo"
)
-func GetWorktreeDisplayStrings(tr *i18n.TranslationSet, worktrees []*models.Worktree, isCurrent func(string) bool, isMissing func(string) bool) [][]string {
+func GetWorktreeDisplayStrings(tr *i18n.TranslationSet, worktrees []*models.Worktree) [][]string {
return lo.Map(worktrees, func(worktree *models.Worktree, _ int) []string {
return GetWorktreeDisplayString(
tr,
- isCurrent(worktree.Path),
- isMissing(worktree.Path),
worktree)
})
}
-func GetWorktreeDisplayString(tr *i18n.TranslationSet, isCurrent bool, isPathMissing bool, worktree *models.Worktree) []string {
+func GetWorktreeDisplayString(tr *i18n.TranslationSet, worktree *models.Worktree) []string {
textStyle := theme.DefaultTextColor
current := ""
currentColor := style.FgCyan
- if isCurrent {
+ if worktree.Current() {
current = " *"
currentColor = style.FgGreen
}
icon := icons.IconForWorktree(false)
- if isPathMissing {
+ if worktree.PathMissing() {
textStyle = style.FgRed
icon = icons.IconForWorktree(true)
}
@@ -45,7 +43,7 @@ func GetWorktreeDisplayString(tr *i18n.TranslationSet, isCurrent bool, isPathMis
if worktree.Main() {
name += " " + tr.MainWorktree
}
- if isPathMissing && !icons.IsIconEnabled() {
+ if worktree.PathMissing() && !icons.IsIconEnabled() {
name += " " + tr.MissingWorktree
}
res = append(res, textStyle.Sprint(name))