411d31e2360b

Make the computer do the busywork
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Wed, 02 Sep 2020 11:45:44 -0400
parents 31e094924f7e
children 5e6b2fd0a0e1
branches/tags (none)
files stumpwmrc

Changes

--- a/stumpwmrc	Mon Aug 31 11:53:56 2020 -0400
+++ b/stumpwmrc	Wed Sep 02 11:45:44 2020 -0400
@@ -1,6 +1,6 @@
 (in-package :stumpwm-user)
 
-(ql:quickload '(:losh :split-sequence :alexandria :parse-number) :silent t)
+(ql:quickload '(:losh :split-sequence :alexandria :parse-number :str :cl-ppcre) :silent t)
 (use-package :losh)
 
 
@@ -18,8 +18,9 @@
       *window-format* "(%n%m%20t)"
       *window-name-source* :title
       *maximum-completions* 20
-      *shell-program* "/home/sjl/src/dotfiles/bin/bash-dammit")
-
+      *shell-program* "/home/sjl/src/dotfiles/bin/bash-dammit"
+      losh:*pbcopy-command* "/home/sjl/src/dotfiles/bin/pbcopy"
+      losh:*pbpaste-command* "/home/sjl/src/dotfiles/bin/pbpaste")
 
 
 ;;;; Utils --------------------------------------------------------------------
@@ -422,6 +423,15 @@
   (run-shell-command "pbeecopy")
   (message "Copied the entire Bee Movie script to clipboard."))
 
+(defcommand urlize-jira-issue () ()
+  (let ((issue (str:trim (pbpaste))))
+    (if (ppcre:scan "^[A-Z0-9]+-\\d+$" issue)
+      (let* ((endpoint (str:trim (run-shell-command "grep endpoint .jira.d/config.yml | sed -e 's/.*: //'" t)))
+             (url (format nil "~A/browse/~A" endpoint issue)))
+        (pbcopy url)
+        (message "Copied ~A to the clipboard." url))
+      (message "Clipboard does not look like a JIRA issue."))))
+
 
 ;;;; Applications -------------------------------------------------------------
 (defcommand spotify () ()
@@ -520,7 +530,7 @@
 (define-top-keys ;; clipboard
   ("H-u" "generate-random-uuid")
   ("H-U" "bee-movie-script")
-  )
+  ("M-H-u" "urlize-jira-issue"))
 
 (define-top-keys ;; movement
   ("H-h" "move-focus* left")