Skip to content

Commit 82932f0

Browse files
committed
feat: deduplicate sessions by name
1 parent 45d3c72 commit 82932f0

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lister/list.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,16 @@ func (l *RealLister) List(opts ListOptions) (model.SeshSessions, error) {
4949
})
5050
})
5151

52+
grouped := lo.GroupBy(allSessions, func(s model.SeshSession) string {
53+
return s.Name
54+
})
55+
56+
allSessions = lo.MapToSlice(grouped, func(_ string, sessions []model.SeshSession) model.SeshSession {
57+
return lo.MaxBy(sessions, func(a, b model.SeshSession) bool {
58+
return a.Score > b.Score
59+
})
60+
})
61+
5262
if opts.HideAttached {
5363
attachedSession, _ := GetAttachedTmuxSession(l)
5464
allSessions = lo.Filter(allSessions, func(s model.SeshSession, _ int) bool {

0 commit comments

Comments
 (0)