Skip to content

Commit

Permalink
fix: fix string literal parsing for delimiter (#30)
Browse files Browse the repository at this point in the history
* fix: fix string literal parsing for delimiter
  • Loading branch information
bashbunni authored Apr 13, 2022
1 parent d7e29a8 commit 659a130
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"os"
"path/filepath"
"strconv"
"strings"
"unicode/utf8"

Expand Down Expand Up @@ -165,7 +166,11 @@ func list(cmd *cobra.Command, args []string) error {
if keysIterate || valuesIterate {
pf = "%s\n"
} else {
pf = fmt.Sprintf("%%s%s%%s\n", delimiterIterate)
var err error
pf, err = strconv.Unquote(fmt.Sprintf(`"%%s%s%%s\n"`, delimiterIterate))
if err != nil {
return err
}
}
if len(args) == 1 {
k = args[0]
Expand All @@ -178,7 +183,10 @@ func list(cmd *cobra.Command, args []string) error {
if err != nil {
return err
}
db.Sync()
err = db.Sync()
if err != nil {
return err
}
return db.View(func(txn *badger.Txn) error {
opts := badger.DefaultIteratorOptions
opts.PrefetchSize = 10
Expand Down

0 comments on commit 659a130

Please sign in to comment.