diff --git a/bitwarden.el b/bitwarden.el index 62000ad..e1c162a 100644 --- a/bitwarden.el +++ b/bitwarden.el @@ -319,7 +319,9 @@ This function is meant to be called by a transient.") (bitwarden--set-config-server)] ["Actions" ("g" "Get current server" bitwarden--action-get-server) - ("s" "Set current server" bitwarden--action-set-server)]) + ("s" "Set current server" bitwarden--action-set-server)] + (interactive) + (transient-setup 'bitwarden-config)) (transient-define-prefix bitwarden-login () ["Options" @@ -331,30 +333,41 @@ This function is meant to be called by a transient.") (bitwarden--set-login-code)] ["Actions" ("l" "Login" bitwarden--action-login) - ("L" "Logout" bitwarden--action-logout)]) + ("L" "Logout" bitwarden--action-logout)] + (interactive) + (transient-setup 'bitwarden-login)) (transient-define-prefix bitwarden-transient () ["Actions" - ("c" "Config" bitwarden--config) - ("l" "Login" bitwarden--login) + ("c" "Config" bitwarden-config) + ("l" "Login" bitwarden-login) ("L" "Lock" bitwarden-lock) - ("s" "sync" bitwarden-dummy)]) + ("s" "sync" bitwarden-dummy)] + (interactive) + (transient-setup 'bitwarden-transient)) ;;; Public functions +;;;###autoload (defun bitwarden-lock () - "Lock the vault and destroy active session keys." + "Lock the vault and destroy active session keys. +The command may fail in the user is not logged in." + (interactive) (progn (setq bitwarden--session nil bitwarden--login-password nil bitwarden--login-passwordenv nil bitwarden--login-passwordfile nil bitwarden--login-code nil) - (bitwarden--run-cli "lock"))) + (bitwarden--run-cli "lock") + (if (= 0 bitwarden--shell-status) + (message "Bitwarden: successfuly locked") + (message "Bitwarden: something went wrong")))) - -;; (defun bitwarden () -;; (interactive) -;; (call-interactively #'bitwarden-transient)) +;;;###autoload +(defun bitwarden () + "Call the main transient for Bitwarden." + (interactive) + (call-interactively #'bitwarden-transient)) (provide 'bitwarden)