From 0a5cfe83fc8f558ea644701f3cf87e4dc8708f6b Mon Sep 17 00:00:00 2001 From: chris bell Date: Tue, 9 Jun 2026 18:46:54 -0500 Subject: [PATCH] Forced 'list' to return instance list sorted alphebetically --- daemon.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/daemon.go b/daemon.go index b8059a5..8542d9b 100644 --- a/daemon.go +++ b/daemon.go @@ -7,6 +7,7 @@ import ( "os" "os/signal" "path/filepath" + "slices" "strconv" "sync" "syscall" @@ -357,6 +358,16 @@ func (ds *DaemonServer) handleList(w http.ResponseWriter, r *http.Request) { }) } + slices.SortFunc(responseList, func(a, b InstanceStatusResponse) int { + if a.Name < b.Name { + return -1 + } + if a.Name > b.Name { + return 1 + } + return 0 + }) + w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusOK) json.NewEncoder(w).Encode(responseList)