mirror of
https://codeberg.org/scip/anydb.git
synced 2025-12-17 04:20:59 +01:00
added db info command
This commit is contained in:
committed by
T.v.Dein
parent
3de65aa1c3
commit
8e400c6831
@@ -26,6 +26,7 @@ import (
|
||||
"github.com/tlinden/anydb/app"
|
||||
"github.com/tlinden/anydb/cfg"
|
||||
"golang.org/x/term"
|
||||
//"github.com/alecthomas/repr"
|
||||
)
|
||||
|
||||
func Print(writer io.Writer, conf *cfg.Config, attr *app.DbAttr, entry *app.DbEntry) error {
|
||||
@@ -93,3 +94,14 @@ func WriteFile(writer io.Writer, conf *cfg.Config, attr *app.DbAttr, entry *app.
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func Info(writer io.Writer, conf *cfg.Config, info *app.DbInfo) error {
|
||||
// repr.Println(info)
|
||||
fmt.Fprintf(writer, "Database: %s\n", info.Path)
|
||||
|
||||
for _, bucket := range info.Buckets {
|
||||
|
||||
fmt.Fprintf(writer, "Bucket: %s\n Size: %d\n Keys: %d\n\n", bucket.Name, bucket.Size, bucket.Keys)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user