Skip to content

Commit

Permalink
changed Fprintln output so it can be tested
Browse files Browse the repository at this point in the history
Signed-off-by: tommy shem <tommy@test.com>
  • Loading branch information
tommy shem committed Nov 12, 2024
1 parent 90f33d5 commit 3f2dd49
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cmd/bbolt/command_buckets.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ func newBucketsCommand() *cobra.Command {
Long: "Print a list of buckets in the given Bolt database\nThe path to a Bolt database must be specified as an argument",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
return printBucketsList(args[0])
return printBucketsList(cmd, args[0])
},
}
return bucketsCmd
}

// printBucketsList prints a list of buckets in the given Bolt database.
func printBucketsList(path string) error {
func printBucketsList(cmd *cobra.Command, path string) error {
// Required database path.
if path == "" {
return ErrPathRequired
Expand All @@ -44,7 +44,7 @@ func printBucketsList(path string) error {
// Print the list of buckets in the database.
return db.View(func(tx *bolt.Tx) error {
return tx.ForEach(func(name []byte, _ *bolt.Bucket) error {
fmt.Fprintln(os.Stdout, string(name))
fmt.Fprintln(cmd.OutOrStdout(), string(name))
return nil
})
})
Expand Down

0 comments on commit 3f2dd49

Please sign in to comment.