feat: add list server command (#2314)

This commit is contained in:
CatsDeservePets authored and GitHub committed 2025-12-21 06:56:43 +01:00
1 parent f0f7cfbbed
commit 59a27bbaed
5 files changed
+36 -6

No files matched your search

+10
View File
@@ -6,6 +6,7 @@ import (
"log"
"net"
"os"
"sort"
"strconv"
)
@@ -106,6 +107,15 @@ Loop:
} else {
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 {
fmt.Fprintln(c, id)
}
case "send":
if rest != "" {
word2, rest2 := splitWord(rest)