Merge pull request #354 from lucash-diskkun/master2

chat: Sort /names output
This commit is contained in:
Andrey Petrov 2020-07-16 13:29:38 -04:00 committed by GitHub
commit d4a5299e1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -7,6 +7,7 @@ import (
"fmt"
"strings"
"time"
"sort"
"github.com/shazow/ssh-chat/chat/message"
"github.com/shazow/ssh-chat/internal/sanitize"
@ -189,6 +190,7 @@ func InitCommands(c *Commands) {
}
names := room.Members.ListPrefix("")
sort.Slice(names, func(i, j int) bool { return names[i].Key() < names[j].Key() })
colNames := make([]string, len(names))
for i, uname := range names {
colNames[i] = colorize(uname.Value().(*Member).User)