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