commit 25eee8934fde8afa1387ac2c6c2c452786a27ad3
parent 8a6485648211a33b9afb01d461a08fe7a9e24eb2
Author: Sean Enck <sean@ttypty.com>
Date: Sat, 19 Jul 2025 08:18:22 -0400
cleanup health output
Diffstat:
2 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/cmd/lb/tests/expected.log b/cmd/lb/tests/expected.log
@@ -322,14 +322,12 @@ test6/multiline/notes
test6/multiline/otp
test6/multiline/password
health
-key
- -> ok
-keyfile
- -> ok
-clipboard
- -> ok
-store
- -> ok
+item status
+--- ---
+key ok
+keyfile ok
+clipboard ok
+store ok
env
LOCKBOX_CLIP_COPY=[touch testdata/datadir/clip.copy]
LOCKBOX_JSON_HASH_LENGTH=3
diff --git a/internal/app/health.go b/internal/app/health.go
@@ -15,14 +15,20 @@ func report(w io.Writer, cat string, err error) {
if err != nil {
msg = fmt.Sprintf("error: %v", err)
}
- text := fmt.Sprintf("%s\n -> %s\n", cat, msg)
+ rawReport(w, cat, msg)
+}
+
+func rawReport(w io.Writer, cat, msg string) {
+ text := fmt.Sprintf("%-15s %s\n", cat, msg)
w.Write([]byte(text))
}
// Health will display configuration/system health
func Health(cmd CommandOptions) error {
- key, err := config.NewKey(config.DefaultKeyMode)
w := cmd.Writer()
+ rawReport(w, "item", "status")
+ rawReport(w, "---", "---")
+ key, err := config.NewKey(config.DefaultKeyMode)
if err == nil {
_, err = key.Read()
}