diff --git a/app/db.go b/app/db.go index 5dcab0a..f4a4473 100644 --- a/app/db.go +++ b/app/db.go @@ -120,7 +120,7 @@ func (db *DB) List(attr *DbAttr) (DbEntries, error) { return nil }) - return fmt.Errorf("failed to read from DB: %w", err) + return err }) return entries, err } diff --git a/output/single.go b/output/single.go index b182c6d..61cda29 100644 --- a/output/single.go +++ b/output/single.go @@ -68,7 +68,7 @@ func Print(writer io.Writer, conf *cfg.Config, attr *app.DbAttr, entry *app.DbEn fmt.Println(string(jsonentry)) case "wide": - ListTable(writer, conf, app.DbEntries{*entry}) + return ListTable(writer, conf, app.DbEntries{*entry}) } return nil diff --git a/t/workflow.txtar b/t/workflow.txtar index bfd0c16..de30e5f 100644 --- a/t/workflow.txtar +++ b/t/workflow.txtar @@ -9,7 +9,7 @@ exec anydb -f test.db list stdout foo.*bar # wide list -exec anydb -f test.db list -o wide +exec anydb -f test.db list -m wide stdout 'plant.*now.*grey' # list tagged @@ -42,6 +42,13 @@ stdout grey exec anydb -f test.db list -t flower ! stdout grey +# check json output +exec anydb -f test.db list -m json +stdout '^\[\{' + +exec anydb -f test.db get color -m json +stdout '^\{' + # delete entry exec anydb -f test.db del foo