guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#58660] [PATCH v2 1/3] etc: teams: Add 'show' subcommand.


From: zimoun
Subject: [bug#58660] [PATCH v2 1/3] etc: teams: Add 'show' subcommand.
Date: Thu, 17 Nov 2022 21:28:18 +0100

* etc/teams.scm.in: Add 'show' subcommand.
---
 etc/teams.scm.in | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/etc/teams.scm.in b/etc/teams.scm.in
index c458b14e3b..e4e0dc209d 100644
--- a/etc/teams.scm.in
+++ b/etc/teams.scm.in
@@ -5,6 +5,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2022 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2022 Mathieu Othacehe <othacehe@gnu.org>
+;;; Copyright © 2022 Simon Tournier <zimon.toutoune@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -538,7 +539,7 @@ (define port* (or port (current-output-port)))
     (team-members team)
     (lambda (m1 m2) (string<? (person-name m1) (person-name m2))))))
 
-(define (list-teams)
+(define* (list-teams #:optional team-names)
   "Print all teams, their scope and their members."
   (define port* (current-output-port))
   (define width* (%text-width))
@@ -564,11 +565,13 @@ (define width* (%text-width))
                (scope (format #f "scope: ~{~s ~}~%" scope))))
      (list-members team port* "+ ")
      (newline))
-   (sort
-    (hash-map->list (lambda (key value) value) %teams)
-    (lambda (team1 team2)
-      (string<? (symbol->string (team-id team1))
-                (symbol->string (team-id team2)))))))
+   (if team-names
+       (map find-team team-names)
+       (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)
@@ -611,6 +614,8 @@ (define (main . args)
       (lambda (team-name)
         (list-members (find-team team-name)))
       team-names))
+    (("show" . team-names)
+     (list-teams team-names))
     (anything
      (format (current-error-port)
              "Usage: etc/teams.scm <command> [<args>]
@@ -619,6 +624,7 @@ (define (main . args)
   cc <team-name>            get git send-email flags for cc-ing <team-name>
   cc-members <start> <end>  cc teams related to files changed between revisions
   list-teams                list teams and their members
-  list-members <team-name>  list members belonging to <team-name>~%"))))
+  list-members <team-name>  list members belonging to <team-name>
+  show <team-name>          display <team-name> properties~%"))))
 
 (apply main (cdr (command-line)))
-- 
2.38.1






reply via email to

[Prev in Thread] Current Thread [Next in Thread]