Skip to content

Instantly share code, notes, and snippets.

@whilp
Created January 4, 2014 19:53
Show Gist options
  • Select an option

  • Save whilp/8259830 to your computer and use it in GitHub Desktop.

Select an option

Save whilp/8259830 to your computer and use it in GitHub Desktop.
(require 'auth-source)
(require 'url)
(defun* my-gh-profile (url user)
(let* (
(urlobj (url-generic-parse-url url))
(host (url-host urlobj))
(auth-info
(car
(auth-source-search
:max 1
:host host
:user user
:port 443
:create nil)))
(token (funcall (plist-get auth-info :secret))))
(list
:url url
:username user
:token token
:remote-regexp (gh-profile-remote-regexp host))))
(setq
gh-profile-default-profile "github"
gh-profile-current-profile nil
gh-profile-alist (list
(cons "bh" (my-gh-profile "https://github.banksimple.com/api/v3" "whilp"))
(cons "gh" (my-gh-profile "https://api.github.com" "whilp"))
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment