From d005ba3401241d0134ed67666835ea4d6493c96b Mon Sep 17 00:00:00 2001 From: Kjetil Orbekk Date: Sat, 8 Mar 2025 18:24:48 -0500 Subject: Expand pass command --- emacs/.config/emacs/init.el | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'emacs') diff --git a/emacs/.config/emacs/init.el b/emacs/.config/emacs/init.el index 2089701..3fee400 100644 --- a/emacs/.config/emacs/init.el +++ b/emacs/.config/emacs/init.el @@ -547,16 +547,23 @@ (with-editor (kj/pass-process "pass" "edit" password)))) -(keymap-global-set "C-c p" #'kj/pass) - -(defun kj/transient-command (&optional args) +(defun kj/pass-generate (&optional args) (interactive - (list (transient-args 'kj/transient))) - (message "args: %s" args)) + (list (transient-args 'kj/pass-generate-transient))) + (let ((password (completing-read "Password name: " (kj/list-passwords) nil nil))) + (apply #'kj/pass-process "pass" "generate" `(,@args ,password)))) + +(keymap-global-set "C-c p" #'kj/pass) (use-package transient :ensure nil :defer 1 :init + (transient-define-prefix kj/pass-generate-transient () + "Generate" + [("-n" "No symbols" "--no-symbols") + ("-c" "Clipboard" "--clip")] + ["" + ("g" "generate" kj/pass-generate)]) (transient-define-prefix kj/transient () "KJ Transient" @@ -568,7 +575,8 @@ ["Pass" ("c" "Clipboard" kj/pass-to-clipboard) ("s" "Show" kj/pass-show) - ("e" "Edit" kj/pass-edit)] + ("e" "Edit" kj/pass-edit) + ("g" "Generate" kj/pass-generate-transient)] ["Repositories" ("l" "List Repositories" magit-list-repositories) ("C" "Clone my project" kj/clone-project)])) -- cgit v1.2.3