ccr/consult-pass

This commit is contained in:
Andrea Ciceri 2023-10-12 15:51:32 +02:00
parent 122a0b4e70
commit 00170bfef8
Signed by: aciceri
SSH key fingerprint: SHA256:/AagBweyV4Hlfg9u092n8hbHwD5fcB6A3qhDiDA65Rg

View file

@ -592,6 +592,15 @@
(advice-add 'eshell-write-history
:around #'ccr/wrap-eshell-write-history)
(defun ccr/consult-pass (&optional otp)
"Interactive search password"
(interactive)
(let* ((entries (password-store-list))
(fun (if otp 'password-store-otp-token-copy 'password-store-copy))
(prompt (if otp "Password: " "OTP: "))
(selected (completing-read prompt entries)))
(apply fun `(,selected))))
(add-to-list 'eshell-modules-list 'eshell-tramp) ;; to use sudo in eshell
;; :hook ((eshell-load . eat-eshell-mode)
;; (eshell-load . eat-eshell-visual-command-mode))