From 00170bfef88b5d565725dbd1fb0510fc479c9c96 Mon Sep 17 00:00:00 2001 From: Andrea Ciceri Date: Thu, 12 Oct 2023 15:51:32 +0200 Subject: [PATCH] `ccr/consult-pass` --- init.el | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/init.el b/init.el index f594fbb..b94e139 100644 --- a/init.el +++ b/init.el @@ -591,7 +591,16 @@ ;; Wrapping this in order to merge histories from different shells (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))