commit 4cf0ad1f3f1bc49cf3ef65d7fb1793d9e70079ac
parent eb928c832c769bc821776d67bf3442ba2c82e793
Author: Sean Enck <sean@ttypty.com>
Date: Tue, 5 Oct 2021 18:16:26 -0400
glob detection can be simpler
Diffstat:
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/cmd/lb/main.go b/cmd/lb/main.go
@@ -175,9 +175,6 @@ func main() {
isShow := command == "show"
entries := []string{inEntry}
if strings.Contains(inEntry, "*") {
- if !isShow {
- stock.Die("cannot glob to clipboard", internal.NewLockboxError("bad glob request"))
- }
matches, err := filepath.Glob(inEntry)
if err != nil {
stock.Die("bad glob", err)
@@ -185,6 +182,11 @@ func main() {
entries = matches
}
isGlob := len(entries) > 1
+ if isGlob {
+ if !isShow {
+ stock.Die("cannot glob to clipboard", internal.NewLockboxError("bad glob request"))
+ }
+ }
for _, entry := range entries {
if !stock.PathExists(entry) {
stock.Die("invalid entry", internal.NewLockboxError("entry not found"))