From 09c8bbdd4c9d02050d79b3aca7ffb318b4264377 Mon Sep 17 00:00:00 2001 From: Lucas Hourahine <luca5h1905@gmail.com> Date: Thu, 16 Jul 2020 13:25:14 -0400 Subject: [PATCH] sorting nicks on /names and /list --- chat/command.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/chat/command.go b/chat/command.go index 182d00f..fe9355e 100644 --- a/chat/command.go +++ b/chat/command.go @@ -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)