emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/buildbot cc9ae2bb82 1/3: Add a command to copy the url


From: ELPA Syncer
Subject: [elpa] externals/buildbot cc9ae2bb82 1/3: Add a command to copy the url of the current view
Date: Wed, 26 Jul 2023 09:57:28 -0400 (EDT)

branch: externals/buildbot
commit cc9ae2bb821e00155827e91a8d9303e9b3da59bd
Author: Yuchen Pei <id@ypei.org>
Commit: Yuchen Pei <id@ypei.org>

    Add a command to copy the url of the current view
---
 buildbot-view.el | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/buildbot-view.el b/buildbot-view.el
index 0cc9b2672a..e31d6e5eda 100644
--- a/buildbot-view.el
+++ b/buildbot-view.el
@@ -48,6 +48,7 @@ One of `revision', `build', `step', or `log'.")
     (define-key kmap "b" #'buildbot-view-previous-header-same-thing)
     (define-key kmap "g" #'buildbot-view-reload)
     (define-key kmap (kbd "<return>") #'buildbot-view-open-thing-at-point)
+    (define-key kmap "w" #'buildbot-view-copy-url)
     kmap)
   "Keymap for `buildbot-view-mode'.")
 
@@ -365,6 +366,30 @@ otherwise pass the value from the current buffer."
   (interactive)
   (buildbot-view-update))
 
+(defun buildbot-view-format-url ()
+  "Format the url of the current view."
+  (unless (derived-mode-p 'buildbot-view-mode)
+    (error "Must be in buildbot mode"))
+  (pcase buildbot-view-type
+    ('branch (format "%s/#grid?branch=%s"
+                     buildbot-host
+                     (alist-get 'branch buildbot-view-data)))
+    ('build
+     (let ((build (alist-get 'build buildbot-view-data)))
+       (format "%s/#/builders/%d/builds/%s"
+               buildbot-host
+               (alist-get 'builderid build)
+               (alist-get 'number build))))
+    (_ (error "Unsupported type for formatting url: %s"
+              buildbot-view-type))))
+
+(defun buildbot-view-copy-url ()
+  "Copy the url of the current view."
+  (interactive)
+  (let ((url (buildbot-view-format-url)))
+    (kill-new url)
+    (message "Copied url: %s" url)))
+
 ;;;###autoload
 (defun buildbot-revision-open (&optional read-host)
   "Open a revision view.



reply via email to

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