fixed read error and updated tests

This commit is contained in:
2024-12-19 11:05:26 +01:00
parent daf52ba3ba
commit 894f2d449e
3 changed files with 10 additions and 3 deletions

View File

@@ -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
}

View File

@@ -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

View File

@@ -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