summaryrefslogtreecommitdiffstats
path: root/pkg/gui/presentation/stash_entries.go
blob: f15b35a9ce504283e8c99f6635fe5014ee18bae5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package presentation

import (
	"github.com/jesseduffield/lazygit/pkg/commands/models"
	"github.com/jesseduffield/lazygit/pkg/theme"
)

func GetStashEntryListDisplayStrings(stashEntries []*models.StashEntry, diffName string) [][]string {
	lines := make([][]string, len(stashEntries))

	for i := range stashEntries {
		diffed := stashEntries[i].RefName() == diffName
		lines[i] = getStashEntryDisplayStrings(stashEntries[i], diffed)
	}

	return lines
}

// getStashEntryDisplayStrings returns the display string of branch
func getStashEntryDisplayStrings(s *models.StashEntry, diffed bool) []string {
	textStyle := theme.DefaultTextColor
	if diffed {
		textStyle = theme.DiffTerminalColor
	}
	return []string{textStyle.Sprint(s.Name)}
}