Skip to content

Commit 4269da0

Browse files
committed
Fix incompatibility with being given 'fzf' query strings
'fzf' appears to pass a single quoted query string to "bind" commands which 'zb tag' will treat as a single tag name, but multiple tags won't match because tags don't contain spaces. If we're given a single argument that has spaces in it, break the string up by splitting on spaces and treating each term as an individual tag as this is more likely what the user meant.
1 parent 6522bdc commit 4269da0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

cmd/tag.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@ package cmd
22

33
import (
44
"github.com/spf13/cobra"
5+
"strings"
56
)
67

78
var tagCmd = &cobra.Command{
89
Use: "tag",
910
Short: "Find anything directly related to one or more tags",
1011
Args: cobra.MinimumNArgs(1),
1112
Run: func(cmd *cobra.Command, args []string) {
13+
if len(args) == 1 {
14+
args = strings.Fields(args[0])
15+
}
1216
renderResults(book().SearchByTags(args...))
1317
},
1418
}

0 commit comments

Comments
 (0)