1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

Fix github linter errors

This commit is contained in:
Luka Markušić
2022-07-30 08:10:29 +02:00
parent 367b0d3318
commit 1f482e585e
5 changed files with 49 additions and 36 deletions

View File

@ -11,7 +11,7 @@ import (
)
func GetReflogCommitListDisplayStrings(commits []*models.Commit, fullDescription bool, cherryPickedCommitShaSet *set.Set[string], diffName string, timeFormat string, parseEmoji bool) [][]string {
var displayFunc func(*models.Commit, string, bool, bool, bool) []string
var displayFunc func(*models.Commit, reflogCommitDisplayAttributes) []string
if fullDescription {
displayFunc = getFullDescriptionDisplayStringsForReflogCommit
} else {
@ -21,7 +21,13 @@ func GetReflogCommitListDisplayStrings(commits []*models.Commit, fullDescription
return slices.Map(commits, func(commit *models.Commit) []string {
diffed := commit.Sha == diffName
cherryPicked := cherryPickedCommitShaSet.Includes(commit.Sha)
return displayFunc(commit, timeFormat, cherryPicked, diffed, parseEmoji)
return displayFunc(commit,
reflogCommitDisplayAttributes{
cherryPicked: cherryPicked,
diffed: diffed,
parseEmoji: parseEmoji,
timeFormat: timeFormat,
})
})
}
@ -38,27 +44,34 @@ func reflogShaColor(cherryPicked, diffed bool) style.TextStyle {
return shaColor
}
func getFullDescriptionDisplayStringsForReflogCommit(c *models.Commit, timeFormat string, cherryPicked, diffed, parseEmoji bool) []string {
type reflogCommitDisplayAttributes struct {
cherryPicked bool
diffed bool
parseEmoji bool
timeFormat string
}
func getFullDescriptionDisplayStringsForReflogCommit(c *models.Commit, attrs reflogCommitDisplayAttributes) []string {
name := c.Name
if parseEmoji {
if attrs.parseEmoji {
name = emoji.Sprint(name)
}
return []string{
reflogShaColor(cherryPicked, diffed).Sprint(c.ShortSha()),
style.FgMagenta.Sprint(utils.UnixToDate(c.UnixTimestamp, timeFormat)),
reflogShaColor(attrs.cherryPicked, attrs.diffed).Sprint(c.ShortSha()),
style.FgMagenta.Sprint(utils.UnixToDate(c.UnixTimestamp, attrs.timeFormat)),
theme.DefaultTextColor.Sprint(name),
}
}
func getDisplayStringsForReflogCommit(c *models.Commit, timeFormat string, cherryPicked, diffed, parseEmoji bool) []string {
func getDisplayStringsForReflogCommit(c *models.Commit, attrs reflogCommitDisplayAttributes) []string {
name := c.Name
if parseEmoji {
if attrs.parseEmoji {
name = emoji.Sprint(name)
}
return []string{
reflogShaColor(cherryPicked, diffed).Sprint(c.ShortSha()),
reflogShaColor(attrs.cherryPicked, attrs.diffed).Sprint(c.ShortSha()),
theme.DefaultTextColor.Sprint(name),
}
}