Fix variables and functions names

This commit is contained in:
Lucien Cartier-Tilet 2022-03-02 17:47:42 +01:00
parent 651fd624d1
commit 55814c703f
Signed by: phundrak
GPG Key ID: BD7789E705CB8DCA
1 changed files with 20 additions and 20 deletions

View File

@ -182,7 +182,7 @@ This macro is largely copied from Tecosaurs screenshot.el"
"-s" "login-sso" "Log in with Single-Sign On" "-s" "login-sso" "Log in with Single-Sign On"
'boolean "0.1.0" 'boolean "0.1.0"
nil nil
(not bitwarden-sso)) (not bitwarden--login-sso))
(bitwarden--define-infix (bitwarden--define-infix
"-e" "login-passwordenv" "Environment variable storing your password" "-e" "login-passwordenv" "Environment variable storing your password"
@ -228,13 +228,13 @@ Return nil otherwise."
(defun bitwarden--get-username () (defun bitwarden--get-username ()
"Get username. "Get username.
If the `bitwarden--username' variable is empty, retrieve it from If the `bitwarden--login-username' variable is empty, retrieve it
the authinfo source." from the authinfo source."
(if (bitwarden--empty-or-nil bitwarden--username) (if (bitwarden--empty-or-nil bitwarden--login-username)
(plist-get (car (auth-source-search :max 1 (plist-get (car (auth-source-search :max 1
:host bitwarden--server)) :host bitwarden--config-server))
:user) :user)
bitwarden--username)) bitwarden--login-username))
(defun bitwarden--get-password () (defun bitwarden--get-password ()
"Get password or password source. "Get password or password source.
@ -244,16 +244,16 @@ designated by the variable `bitwarden--login-passwordenv', by the
file designated by the variable `bitwarden--login-passwordfile', file designated by the variable `bitwarden--login-passwordfile',
or from the authinfo source." or from the authinfo source."
(cond (cond
((! (bitwarden--empty-or-nil bitwarden--passwordenv))
`("--passwordenv" ,bitwarden--passwordenv))
((! (bitwarden--set-passwordfile bitwarden--passwordfile))
`("--passwordfile" ,bitwarden--passwordfile))
(bitwarden--login-password (bitwarden--login-password
(read-passwd "Bitwarden Password: ")) (read-passwd "Bitwarden Password: "))
((not (bitwarden--empty-or-nil bitwarden--login-passwordenv))
`("--passwordenv" ,bitwarden--login-passwordenv))
((not (bitwarden--empty-or-nil bitwarden--login-passwordfile))
`("--passwordfile" ,bitwarden--login-passwordfile))
(t (funcall (t (funcall
(plist-get (plist-get
(car (auth-source-search :max 1 (car (auth-source-search :max 1
:host bitwarden--server)) :host bitwarden--config-server))
:secret))))) :secret)))))
@ -275,13 +275,13 @@ This function is meant to be called by a transient.")
(bitwarden--def-action (bitwarden--def-action
"set-server" "set-server"
"Set the Bitwarden server." "Set the Bitwarden server."
'bitwarden--server 'bitwarden--login-server
(bitwarden--run-cli "config" "server" bitwarden--server)) (bitwarden--run-cli "config" "server" bitwarden--config-server))
(bitwarden--def-action (bitwarden--def-action
"get-server" "get-server"
"Get the URL of the on-premises hosted installation." "Get the URL of the on-premises hosted installation."
'bitwarden--server 'bitwarden--config-server
(bitwarden--run-cli "config" "server")) (bitwarden--run-cli "config" "server"))
;; Login ;; Login
@ -290,7 +290,7 @@ This function is meant to be called by a transient.")
"login" "login"
"Log in Bitwarden." "Log in Bitwarden."
'bitwarden--login 'bitwarden--login
(if bitwarden--sso (if bitwarden--login-sso
(bitwarden--run-cli "login" "--raw" "--sso") (bitwarden--run-cli "login" "--raw" "--sso")
(bitwarden--run-cli "login" "--raw" (bitwarden--run-cli "login" "--raw"
(format "\"%s\"" (bitwarden--get-username)) (format "\"%s\"" (bitwarden--get-username))
@ -344,11 +344,11 @@ This function is meant to be called by a transient.")
(defun bitwarden-lock () (defun bitwarden-lock ()
"Lock the vault and destroy active session keys." "Lock the vault and destroy active session keys."
(progn (progn
(setq bitwarden--session nil (setq bitwarden--session nil
bitwarden--password nil bitwarden--login-password nil
bitwarden--passwordenv nil bitwarden--login-passwordenv nil
bitwarden--passwordfile nil bitwarden--login-passwordfile nil
bitwarden--code nil) bitwarden--login-code nil)
(bitwarden--run-cli "lock"))) (bitwarden--run-cli "lock")))