Skip to content

Commit

Permalink
Fix incompatibility with being given 'fzf' query strings
Browse files Browse the repository at this point in the history
'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.
  • Loading branch information
msp301 committed Apr 28, 2024
1 parent 6522bdc commit 4269da0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmd/tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@ package cmd

import (
"github.com/spf13/cobra"
"strings"
)

var tagCmd = &cobra.Command{
Use: "tag",
Short: "Find anything directly related to one or more tags",
Args: cobra.MinimumNArgs(1),
Run: func(cmd *cobra.Command, args []string) {
if len(args) == 1 {
args = strings.Fields(args[0])
}
renderResults(book().SearchByTags(args...))
},
}
Expand Down

0 comments on commit 4269da0

Please sign in to comment.