func (c *listCommand) Run() error { buckets, err := clibolt.SplitBuckets(c.Arguments.Bucket) if err != nil { return err } err = clibolt.Bolt.State.DB.View(func(tx *bolt.Tx) error { bucket, err := clibolt.LookupBucket(tx, buckets) if err != nil { return err } c := bucket.Cursor() for k, v := c.First(); k != nil; k, v = c.Next() { if v == nil { // skip buckets continue } _, err := fmt.Println(clibolt.EncodeKey(k)) if err != nil { return err } } return nil }) return err }
func (c *bucketsCommand) runRoot() error { err := clibolt.Bolt.State.DB.View(func(tx *bolt.Tx) error { return tx.ForEach(func(name []byte, b *bolt.Bucket) error { _, err := fmt.Println(clibolt.EncodeKey(name)) return err }) }) return err }
func (c *bucketsCommand) runSub(buckets [][]byte) error { err := clibolt.Bolt.State.DB.View(func(tx *bolt.Tx) error { bucket, err := clibolt.LookupBucket(tx, buckets) if err != nil { return err } c := bucket.Cursor() for k, v := c.First(); k != nil; k, v = c.Next() { if v != nil { // not a bucket continue } _, err := fmt.Println(clibolt.EncodeKey(k)) if err != nil { return err } } return nil }) return err }