diff options
author | Stefan Haller <stefan@haller-berlin.de> | 2023-12-21 21:17:48 +0100 |
---|---|---|
committer | Stefan Haller <stefan@haller-berlin.de> | 2024-01-26 08:29:04 +0100 |
commit | 7fb526602704caa02ebd481603b43fcd7ed4bf14 (patch) | |
tree | d9f7fab8f182f08775387f135f017a182e8bbfd9 /pkg/gui/presentation | |
parent | ae89dde9694d0d8c25961047f098b8ca63441ff0 (diff) |
Use inline status for fetching remotes
Diffstat (limited to 'pkg/gui/presentation')
-rw-r--r-- | pkg/gui/presentation/item_operations.go | 2 | ||||
-rw-r--r-- | pkg/gui/presentation/remotes.go | 28 |
2 files changed, 26 insertions, 4 deletions
diff --git a/pkg/gui/presentation/item_operations.go b/pkg/gui/presentation/item_operations.go index 85b81a123..13415483b 100644 --- a/pkg/gui/presentation/item_operations.go +++ b/pkg/gui/presentation/item_operations.go @@ -17,6 +17,8 @@ func ItemOperationToString(itemOperation types.ItemOperation, tr *i18n.Translati return tr.FastForwarding case types.ItemOperationDeleting: return tr.DeletingStatus + case types.ItemOperationFetching: + return tr.FetchingStatus } return "" diff --git a/pkg/gui/presentation/remotes.go b/pkg/gui/presentation/remotes.go index 1fbedf9cc..dc0f39ec0 100644 --- a/pkg/gui/presentation/remotes.go +++ b/pkg/gui/presentation/remotes.go @@ -1,22 +1,37 @@ package presentation import ( + "time" + "github.com/jesseduffield/lazygit/pkg/commands/models" "github.com/jesseduffield/lazygit/pkg/gui/presentation/icons" "github.com/jesseduffield/lazygit/pkg/gui/style" + "github.com/jesseduffield/lazygit/pkg/gui/types" + "github.com/jesseduffield/lazygit/pkg/i18n" "github.com/jesseduffield/lazygit/pkg/theme" + "github.com/jesseduffield/lazygit/pkg/utils" "github.com/samber/lo" ) -func GetRemoteListDisplayStrings(remotes []*models.Remote, diffName string) [][]string { +func GetRemoteListDisplayStrings( + remotes []*models.Remote, + diffName string, + getItemOperation func(item types.HasUrn) types.ItemOperation, + tr *i18n.TranslationSet, +) [][]string { return lo.Map(remotes, func(remote *models.Remote, _ int) []string { diffed := remote.Name == diffName - return getRemoteDisplayStrings(remote, diffed) + return getRemoteDisplayStrings(remote, diffed, getItemOperation(remote), tr) }) } // getRemoteDisplayStrings returns the display string of branch -func getRemoteDisplayStrings(r *models.Remote, diffed bool) []string { +func getRemoteDisplayStrings( + r *models.Remote, + diffed bool, + itemOperation types.ItemOperation, + tr *i18n.TranslationSet, +) []string { branchCount := len(r.Branches) textStyle := theme.DefaultTextColor @@ -28,6 +43,11 @@ func getRemoteDisplayStrings(r *models.Remote, diffed bool) []string { if icons.IsIconEnabled() { res = append(res, textStyle.Sprint(icons.IconForRemote(r))) } - res = append(res, textStyle.Sprint(r.Name), style.FgBlue.Sprintf("%d branches", branchCount)) + descriptionStr := style.FgBlue.Sprintf("%d branches", branchCount) + itemOperationStr := ItemOperationToString(itemOperation, tr) + if itemOperationStr != "" { + descriptionStr += " " + style.FgCyan.Sprint(itemOperationStr+" "+utils.Loader(time.Now())) + } + res = append(res, textStyle.Sprint(r.Name), descriptionStr) return res } |