Subject: bug#77971: [PATCH] client: Support opening a particular issue in the web browser.

From: jgart <[email-masked]>
Date: Mon, 21 Apr 2025 14:10:46 -0500

* mumi/client.scm (www): Add support for passing in an issue number.
* scripts/mumi.in (show-mumi-usage): Update CLI documentation to
reflect above change.
* scripts/mumi.in: Update top-level match to include the case where an
issue-number is passed in.
---
 mumi/client.scm | 10 ++++++----
 scripts/mumi.in |  6 ++++--
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/mumi/client.scm b/mumi/client.scm
index 1116c56..8fe5f4d 100644
--- a/mumi/client.scm
+++ b/mumi/client.scm
@@ -302,13 +302,15 @@ if it exits non-locally. Return the value returned by PROC."
   (unless (zero? (apply system* args))
     (error "Command invocation failed" args)))
 
-(define (www)
-  "Open current issue in a web browser."
-  (let ((issue-number (current-issue-number)))
+(define* (www #:optional (issue-number (current-issue-number)))
+  "Open current issue number or given ISSUE-NUMBER in a web browser."
+  (let ((issue-number (if (string? issue-number) 
+                        issue-number
+                        (number->string issue-number))))
     (if issue-number
         (invoke (%config 'xdg-open)
                 (uri->string
-                 (build-mumi-uri (string-append "/" (number->string issue-number)))))
+                 (build-mumi-uri (string-append "/" issue-number))))
         (begin
           (format (current-error-port) "No current issue!~%")
           (exit #f)))))
diff --git a/scripts/mumi.in b/scripts/mumi.in
index 960fb9b..749fdfc 100644
--- a/scripts/mumi.in
+++ b/scripts/mumi.in
@@ -151,8 +151,8 @@
     `mumi new':
          clear current issue presumably to open a new one.
 
-    `mumi www':
-         open current issue in a web browser.
+    `mumi www [ISSUE-NUMBER]':
+         open given issue or current issue in a web browser.
 
     `mumi compose [--close|--done]':
          compose email to debbugs.
@@ -221,6 +221,8 @@ elements after the DELIMITER."
    (client:git-send-email-headers patch))
   (("www")
    (client:www))
+  (("www" issue-number)
+   (client:www issue-number))
   (("compose" . args)
    (let ((args (args-fold args
                           (list (option '("close") #f #f
-- 
2.49.0