Add function to open blob log in browser

This commit is contained in:
Jeremy Dormitzer 2020-04-17 18:09:05 -04:00
parent 8bac9ecbd0
commit 51cd3f7401

View File

@ -4816,7 +4816,22 @@ Syntax highlighting for Dockerfiles:
:init :init
(jdormit/define-prefix "fS" "s3") (jdormit/define-prefix "fS" "s3")
(leader-def-key "fSf" #'s3ed-find-file) (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 #+END_SRC
* Prodigy * Prodigy