commit eb928c832c769bc821776d67bf3442ba2c82e793
parent a2ff63245c08a95ca04e6b71904905bad2c429dd
Author: Sean Enck <sean@ttypty.com>
Date: Tue, 5 Oct 2021 18:15:21 -0400
fallback to non-glob if only one file found
Diffstat:
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/cmd/lb/main.go b/cmd/lb/main.go
@@ -174,18 +174,17 @@ func main() {
inEntry := getEntry(store, args, 2)
isShow := command == "show"
entries := []string{inEntry}
- isGlob := false
if strings.Contains(inEntry, "*") {
if !isShow {
stock.Die("cannot glob to clipboard", internal.NewLockboxError("bad glob request"))
}
- isGlob = true
matches, err := filepath.Glob(inEntry)
if err != nil {
stock.Die("bad glob", err)
}
entries = matches
}
+ isGlob := len(entries) > 1
for _, entry := range entries {
if !stock.PathExists(entry) {
stock.Die("invalid entry", internal.NewLockboxError("entry not found"))