[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
03/07: etc: teams: Refactor list-teams.
From: |
guix-commits |
Subject: |
03/07: etc: teams: Refactor list-teams. |
Date: |
Tue, 29 Aug 2023 14:55:17 -0400 (EDT) |
apteryx pushed a commit to branch master
in repository guix.
commit ee4a429d4905fbe05f5f642fae6249747b43f0dd
Author: Maxim Cournoyer <maxim.cournoyer@gmail.com>
AuthorDate: Tue Aug 29 13:53:49 2023 -0400
etc: teams: Refactor list-teams.
* etc/teams.scm.in (print-team, sort-teams): New procedures.
(list-teams): Use them.
---
etc/teams.scm.in | 56 ++++++++++++++++++++++++++++++--------------------------
1 file changed, 30 insertions(+), 26 deletions(-)
diff --git a/etc/teams.scm.in b/etc/teams.scm.in
index b017bb3d1a..3630044ca6 100644
--- a/etc/teams.scm.in
+++ b/etc/teams.scm.in
@@ -672,37 +672,41 @@ TEAMS when a patch is received by Debbugs."
(format #t "~a~a~%" prefix (member->string member)))
(sort-members (team-members team))))
-(define (list-teams)
- "Print all teams, their scope and their members."
- (define port* (current-output-port))
- (define width* (%text-width))
- (for-each
- (lambda (team)
- (format port*
- "\
+(define (print-team team)
+ "Print TEAM, a <team> record object."
+ (format #t
+ "\
id: ~a
name: ~a
description: ~a
~amembers:
"
- (team-id team)
- (team-name team)
- (or (and=> (team-description team)
- (lambda (text)
- (string->recutils
- (fill-paragraph text width*
- (string-length "description: ")))))
- "<none>")
- (match (team-scope team)
- (() "")
- (scope (format #f "scope: ~{~s ~}~%" scope))))
- (list-members team #:prefix "+ ")
- (newline))
- (sort
- (hash-map->list (lambda (key value) value) %teams)
- (lambda (team1 team2)
- (string<? (symbol->string (team-id team1))
- (symbol->string (team-id team2)))))))
+ (team-id team)
+ (team-name team)
+ (or (and=> (team-description team)
+ (lambda (text)
+ (string->recutils
+ (fill-paragraph text (%text-width)
+ (string-length "description: ")))))
+ "<none>")
+ (match (team-scope team)
+ (() "")
+ (scope (format #f "scope: ~{~s ~}~%" scope))))
+ (list-members team #:prefix "+ ")
+ (newline)))
+
+(define (sort-teams teams)
+ "Sort TEAMS, a list of <team> record objects."
+ (sort teams
+ (lambda (team1 team2)
+ (string<? (symbol->string (team-id team1))
+ (symbol->string (team-id team2))))))
+
+(define* (list-teams)
+ "Print all teams, their scope and their members."
+ (for-each print-team
+ (sort-teams (hash-map->list
+ (lambda (_ value) value) %teams))))
(define (diff-revisions rev-start rev-end)
- branch master updated (37a8f92340 -> 0d9619354b), guix-commits, 2023/08/29
- 07/07: doc: Fix a potential problem in man page generation rule., guix-commits, 2023/08/29
- 03/07: etc: teams: Refactor list-teams.,
guix-commits <=
- 06/07: etc: teams: Sort and improve display of regular expression in 'scope' field., guix-commits, 2023/08/29
- 01/07: teams: Register the guix-emacs.el file to the Emacs team., guix-commits, 2023/08/29
- 04/07: etc: teams: Add 'show' subcommand and sort teams., guix-commits, 2023/08/29
- 02/07: etc: teams: Drop unused port argument for list-members procedure., guix-commits, 2023/08/29
- 05/07: etc: teams: Itemize 'scope' field., guix-commits, 2023/08/29