Skip to content

Commit

Permalink
fix: sorting tmux sessions that haven't been attached
Browse files Browse the repository at this point in the history
  • Loading branch information
joshmedeski committed Jan 22, 2024
1 parent 948a5c8 commit fdec6b4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tmux/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,12 @@ func List() ([]*TmuxSession, error) {
sessions = append(sessions, session)
}
sort.Slice(sessions, func(i, j int) bool {
if sessions[i].LastAttached == nil {
return false
}
if sessions[j].LastAttached == nil {
return true
}
return sessions[j].LastAttached.Before(*sessions[i].LastAttached)
})
}
Expand Down

0 comments on commit fdec6b4

Please sign in to comment.