From 51cd3f740181b6400fd2cdff040efae8f6dcde1d Mon Sep 17 00:00:00 2001 From: Jeremy Dormitzer Date: Fri, 17 Apr 2020 18:09:05 -0400 Subject: [PATCH] Add function to open blob log in browser --- emacs/init.org | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/emacs/init.org b/emacs/init.org index f75f678..d7c6e59 100755 --- a/emacs/init.org +++ b/emacs/init.org @@ -4816,7 +4816,22 @@ Syntax highlighting for Dockerfiles: :init (jdormit/define-prefix "fS" "s3") (leader-def-key "fSf" #'s3ed-find-file) - (leader-def-key "fSs" #'s3ed-save-file)) + (leader-def-key "fSs" #'s3ed-save-file) + :config + (defun s3ed-open-blob-log () + "Opens the blob log at point via the cloudfront proxy." + (interactive) + (let ((fname-at-point (dired-file-name-at-point))) + (if (string-match + "\\(bloblogs.ops.lola.co[m]*\\)\/blobs\/\\(\\(production\\|dev\\|local\\|smoke\\|staging\\)\/[0-9]+/.*\\)" + fname-at-point) + (let* ((host (match-string 1 fname-at-point)) + (path (match-string 2 fname-at-point)) + (proxy-url (format "https://%s/%s" host path))) + (browse-url proxy-url)) + (error "Not in a blob logs directory")))) + :general + ((normal) s3ed-mode-map "B" #'s3ed-open-blob-log)) #+END_SRC * Prodigy