Skip to content

Commit 35f319c

Browse files
committed
feat: deduplicate zoxide sessions by basename
1 parent 82932f0 commit 35f319c

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
@@ -1,6 +1,8 @@
11
package lister
22

33
import (
4+
"path/filepath"
5+
"slices"
46
"sort"
57

68
"github.com/joshmedeski/sesh/model"
@@ -59,6 +61,14 @@ func (l *RealLister) List(opts ListOptions) (model.SeshSessions, error) {
5961
})
6062
})
6163

64+
runningSessionNames := lo.FilterMap(allSessions, func(s model.SeshSession, _ int) (string, bool) {
65+
return s.Name, s.Src == "tmux"
66+
})
67+
68+
allSessions = lo.Filter(allSessions, func(s model.SeshSession, _ int) bool {
69+
return s.Src != "zoxide" || !slices.Contains(runningSessionNames, filepath.Base(s.Path))
70+
})
71+
6272
if opts.HideAttached {
6373
attachedSession, _ := GetAttachedTmuxSession(l)
6474
allSessions = lo.Filter(allSessions, func(s model.SeshSession, _ int) bool {

0 commit comments

Comments
 (0)