This commit is contained in:
Pavel Korytov 2022-02-12 22:20:55 +03:00
parent 9d34d0ce23
commit e13a97d870

View file

@ -41,6 +41,8 @@
;;; Code: ;;; Code:
(require 'ivy) (require 'ivy)
(require 'seq) (require 'seq)
(require 'auth-source-pass)
(require 'password-store)
(defgroup ivy-pass () (defgroup ivy-pass ()
"An ivy-based pass frontend." "An ivy-based pass frontend."
@ -56,8 +58,6 @@
:type 'integer :type 'integer
:group 'ivy-pass) :group 'ivy-pass)
(setq ivy-pass-sequences nil)
(defcustom ivy-pass-sequences (defcustom ivy-pass-sequences
'((autotype . (wait '((autotype . (wait
(field . "username") (field . "username")
@ -76,7 +76,7 @@ basic actions):
- username - username
- url - url
Values are lists of symbols that determine action. Take a look at Values are lists of symbols that determine action. Take a look at
`ivy-pass--get-commands' for available options." `ivy-pass--get-commands' for available options."
:group 'ivy-pass :group 'ivy-pass
:options '(autotype password username url) :options '(autotype password username url)
@ -113,7 +113,7 @@ Call CALLBACK when the command in finished."
"-c" command))) "-c" command)))
(set-process-sentinel (set-process-sentinel
proc proc
(lambda (process msg) (lambda (process _msg)
(pcase (process-status process) (pcase (process-status process)
('exit (funcall callback)) ('exit (funcall callback))
('fatal (error "Error in running %s" command))))))) ('fatal (error "Error in running %s" command)))))))
@ -250,8 +250,8 @@ the current entry available via the `entry' variable."
`(,field-name `(,field-name
. ,(condition-case err . ,(condition-case err
(eval (car (read-from-string (cdr item)))) (eval (car (read-from-string (cdr item))))
(error (format "Error in %s: %s" field-name (error (user-error "Error in %s: %s" field-name
(prin1-to-string err))))) (prin1-to-string err)))))
`(,field-name . (wait (field . ,(car item))))))) `(,field-name . (wait (field . ,(car item)))))))
entry))) entry)))
(ivy-read "Field: " sequences (ivy-read "Field: " sequences