refactor: simplify list command (#2471)

This commit is contained in:
CatsDeservePets authored and GitHub committed 2026-03-25 21:29:32 +01:00
1 parent 6d5b9f924e
commit 27d476f376
1 file changed
+3 -7
+3 -7
View File
@@ -4,9 +4,10 @@ import (
"bufio"
"fmt"
"log"
"maps"
"net"
"os"
"sort"
"slices"
"strconv"
)
@@ -108,12 +109,7 @@ Loop:
echoerr(c, "listen: drop: requires a client id")
}
case "list":
ids := make([]int, 0, len(gConnList))
for id := range gConnList {
ids = append(ids, id)
}
sort.Ints(ids)
for _, id := range ids {
for _, id := range slices.Sorted(maps.Keys(gConnList)) {
fmt.Fprintln(c, id)
}
case "send":