Last active
August 20, 2024 11:58
-
-
Save kidd/3792e52875fd3afbf539c51122ec8352 to your computer and use it in GitHub Desktop.
advice browse-url-at-point to account for stripe ids
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; (keymap-global-set "C-c o" 'browse-url-at-point) | |
(defun rgc/add-stripe (args) | |
"prepend the right stripe path to be able to find the entity | |
you're looking for" | |
(let* ((arg (s-replace-regexp "^https?://" "" (car args))) | |
(path | |
(cond | |
((s-match "^price_.*" arg) "prices") | |
((s-match "^sub_.*" arg) "subscriptions") | |
((s-match "^prod_.*" arg) "products") | |
((s-match "^evt_.*" arg) "events") | |
((s-match "^ch_.*" arg) "charges") | |
((s-match "^cus_.*" arg) "customers")))) | |
(if path | |
(cons (concat "https://dashboard.stripe.com/" (when (not current-prefix-arg) "test/") path "/" arg) nil) | |
args))) | |
(advice-add 'browse-url :filter-args #'rgc/add-stripe) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment