Parse list pw json response

This commit is contained in:
bom 2024-11-22 13:48:58 +01:00
parent 9441cfa773
commit bd7ea0ccba
2 changed files with 9 additions and 4 deletions

View file

@ -3,7 +3,8 @@
[orchestra.core :refer [defn-spec]] [orchestra.core :refer [defn-spec]]
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[dda.backup.cred-rot.domain :as domain] [dda.backup.cred-rot.domain :as domain]
[dda.backup.infrastructure :as i])) [dda.backup.infrastructure :as i]
[cheshire.core :as cc]))
(s/def ::new-password-file string?) (s/def ::new-password-file string?)
@ -19,9 +20,13 @@
(if (not (nil? new-password-file)) (if (not (nil? new-password-file))
(i/execute! (domain/add-password-command config) config)))) (i/execute! (domain/add-password-command config) config))))
(defn-spec list-passwords! nil? (defn-spec list-passwords! map?
[config ::cred-rot] [config ::cred-rot]
(i/execute! (domain/list-passwords-command config) config)) (i/execute-out! (domain/list-passwords-command config) config))
(defn-spec parse-passwords! nil?
[config ::cred-rot]
(println (cc/parse-string (list-passwords! config))))
(defn-spec replace-old-password! nil? (defn-spec replace-old-password! nil?
[] []

View file

@ -57,7 +57,7 @@
(defn-spec list-passwords-command ::cd/command (defn-spec list-passwords-command ::cd/command
[config ::config] [config ::config]
[(base-command config ["key" "list" "--json"])]) (base-command config ["key" "list" "--json"]))
(defn-spec add-password-command ::cd/command (defn-spec add-password-command ::cd/command
[config ::config] [config ::config]