Skip to content

Commit fdec6b4

Browse files
committed
fix: sorting tmux sessions that haven't been attached
1 parent 948a5c8 commit fdec6b4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tmux/list.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,12 @@ func List() ([]*TmuxSession, error) {
147147
sessions = append(sessions, session)
148148
}
149149
sort.Slice(sessions, func(i, j int) bool {
150+
if sessions[i].LastAttached == nil {
151+
return false
152+
}
153+
if sessions[j].LastAttached == nil {
154+
return true
155+
}
150156
return sessions[j].LastAttached.Before(*sessions[i].LastAttached)
151157
})
152158
}

0 commit comments

Comments
 (0)