Add devpi commands
This commit is contained in:
parent
fbd05357f2
commit
67a83350fa
@ -2918,6 +2918,62 @@ The aws-mfa command:
|
||||
(interactive)
|
||||
(sudo-shell-command "killall -HUP mDNSResponder"))
|
||||
#+END_SRC
|
||||
** Devpi
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defvar devpi-indices nil
|
||||
"Login profiles for devpi. An alist
|
||||
where the keys are index names and
|
||||
the values are alists with the keys
|
||||
devpi-index-url, devpi-index-username,
|
||||
and devpi-index-password-fn.")
|
||||
|
||||
(setq devpi-indices
|
||||
`((pip .
|
||||
((devpi-index-url . "https://pip.aws.lolatravel.com/pip/dev")
|
||||
(devpi-index-username . "pip")
|
||||
(devpi-index-password-fn . ,(lambda ()
|
||||
(op-get-item-field
|
||||
(op-get-item "PIP Devpi Login")
|
||||
"password")))))
|
||||
(jdormit .
|
||||
((devpi-index-url . "https://pip.aws.lolatravel.com/jdormit/dev")
|
||||
(devpi-index-username . "jdormit")
|
||||
(devpi-index-password-fn . ,(lambda ()
|
||||
(password-store-get "devpi-jdormit")))))))
|
||||
|
||||
(defun devpi-use-index (index-name)
|
||||
(interactive
|
||||
(list
|
||||
(intern
|
||||
(ido-completing-read+
|
||||
"Devpi index to use: "
|
||||
(mapcar #'car devpi-indices)))))
|
||||
(cl-letf* ((index-alist (alist-get index-name devpi-indices))
|
||||
(index-url (alist-get 'devpi-index-url index-alist))
|
||||
(index-username (alist-get 'devpi-index-username index-alist))
|
||||
((symbol-function 'index-password-fn) (alist-get 'devpi-index-password-fn index-alist))
|
||||
(index-password (index-password-fn))
|
||||
((symbol-function 'devpi-use) (make-process-fn "devpi" "use" index-url))
|
||||
((symbol-function 'devpi-login)
|
||||
(make-process-fn "devpi" "login" index-username "--password" index-password))
|
||||
(login-result (devpi-login))
|
||||
(use-result (devpi-use)))
|
||||
(save-match-data
|
||||
(if (and (string-match "credentials valid" login-result)
|
||||
(string-match "current devpi index" use-result))
|
||||
(message "Switched to Devpi index %s" index-name)
|
||||
(with-current-buffer (get-buffer-create "*devpi*")
|
||||
(erase-buffer)
|
||||
(goto-char (point-min))
|
||||
(insert login-result)
|
||||
(insert use-result))
|
||||
(message "Failed to switch to Devpi index %s - check the *devpi* buffer for details" index-name)))))
|
||||
|
||||
(defun devpi-upload ()
|
||||
(interactive)
|
||||
(cl-letf (((symbol-function 'devpi-upload) (make-process-fn "devpi" "upload")))
|
||||
(devpi-upload)))
|
||||
#+END_SRC
|
||||
* StumpWM
|
||||
A handy keybinding to connect to the StumpWM SBCL process via SLIME:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
|
Loading…
Reference in New Issue
Block a user