Simplify setting server

This commit is contained in:
Lucien Cartier-Tilet 2022-03-16 17:43:54 +01:00
parent dd1a740350
commit 3e2d16ad64
Signed by: phundrak
GPG Key ID: BD7789E705CB8DCA

View File

@ -164,7 +164,9 @@ This macro is largely copied from Tecosaurs screenshot.el"
(if (eq 0 bitwarden--shell-status)
(string-trim output-str "https?://")
""))
(read-string "Server URL: "))
(let ((server (read-string "Server URL: ")))
(bitwarden--run-cli "config" "server" server)
server))
;; Login
@ -273,21 +275,13 @@ This function is meant to be called by a transient.")
,@body))
;; Config
(bitwarden--def-action
"set-server"
"Set the Bitwarden server."
"config-quit"
"Exit Bitwarden config."
'bitwarden-config
(bitwarden--run-cli "config" "server" bitwarden--config-server))
(bitwarden--def-action
"get-server"
"Get the URL of the on-premises hosted installation."
'bitwarden-config
(bitwarden--run-cli "config" "server"))
#'nil)
;; Login
(bitwarden--def-action
"login"
"Log in Bitwarden."
@ -310,8 +304,7 @@ This function is meant to be called by a transient.")
["Options"
(bitwarden--set-config-server)]
["Actions"
("g" "Get current server" bitwarden--action-get-server)
("s" "Set current server" bitwarden--action-set-server)]
("q" "Quit" bitwarden--action-config-quit)]
(interactive)
(transient-setup 'bitwarden-config))