Subject: [PATCH 3/4] etc: teams: List teams sorted by id.

From: zimoun <[email-masked]>
Date: Thu, 20 Oct 2022 15:28:13 +0200

* etc/teams.scm.in (list-teams): Sort teams by id.
---
 etc/teams.scm.in | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/etc/teams.scm.in b/etc/teams.scm.in
index 8e18a5d206..3d4c7319c2 100644
--- a/etc/teams.scm.in
+++ b/etc/teams.scm.in
@@ -556,8 +556,8 @@ (define (list-teams)
   "Print all teams, their scope and their members."
   (define port* (current-output-port))
   (define width* (%text-width))
-  (hash-for-each
-   (lambda (key team)
+  (for-each
+   (lambda (team)
      (format port*
              "\
 id: ~a
@@ -584,7 +584,11 @@ (define width* (%text-width))
                                string<=?)))))
      (list-members team port* "+ ")
      (newline))
-   %teams))
+   (sort
+    (hash-map->list (lambda (key value) value) %teams)
+    (lambda (team1 team2)
+      (string<? (symbol->string (team-id team1))
+                (symbol->string (team-id team2)))))))
 
 
 (define (diff-revisions rev-start rev-end)
-- 
2.36.0