Subject: [bug#58660] [PATCH 4/4] etc: teams: Display an id number.

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

* etc/teams.scm.in (list-teams): Add id number for easing 'recutils' use.
---
 etc/teams.scm.in | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/etc/teams.scm.in b/etc/teams.scm.in
index 3d4c7319c2..790eb17131 100644
--- a/etc/teams.scm.in
+++ b/etc/teams.scm.in
@@ -556,15 +556,16 @@ (define (list-teams)
   "Print all teams, their scope and their members."
   (define port* (current-output-port))
   (define width* (%text-width))
-  (for-each
-   (lambda (team)
+  (fold
+   (lambda (team id-number)
      (format port*
              "\
-id: ~a
+id: (~d) ~a
 name: ~a
 description: ~a
 ~amembers:
 "
+             id-number
              (team-id team)
              (team-name team)
              (or (and=> (team-description team)
@@ -583,7 +584,9 @@ (define width* (%text-width))
                                     scope)
                                string<=?)))))
      (list-members team port* "+ ")
-     (newline))
+     (newline)
+     (1+ id-number))
+   0
    (sort
     (hash-map->list (lambda (key value) value) %teams)
     (lambda (team1 team2)
-- 
2.36.0