Skip to content

Commit

Permalink
Add wildcard support
Browse files Browse the repository at this point in the history
Signed-off-by: jolheiser <john.olheiser@gmail.com>
  • Loading branch information
jolheiser committed Oct 1, 2021
1 parent e19e06a commit e380c7b
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,14 @@ func Run() (err error) {
&cli.StringFlag{Name: "ports", Value: "9009,9010,9011,9012,9013", Usage: "ports of the local relay (optional)"},
},
HelpName: "croc send",
Action: func(c *cli.Context) error {
return send(c)
},
Action: send,
},
{
Name: "relay",
Usage: "start your own relay (optional)",
Description: "start relay",
HelpName: "croc relay",
Action: func(c *cli.Context) error {
return relay(c)
},
Action: relay,
Flags: []cli.Flag{
&cli.StringFlag{Name: "ports", Value: "9009,9010,9011,9012,9013", Usage: "ports of the relay"},
},
Expand Down Expand Up @@ -352,6 +348,17 @@ func getPaths(fnames []string) (paths []string, haveFolder bool, err error) {
haveFolder = false
paths = []string{}
for _, fname := range fnames {
// Support wildcard
if strings.Contains(fname, "*") {
matches, errGlob := filepath.Glob(fname)
if errGlob != nil {
err = errGlob
return
}
paths = append(paths, matches...)
continue
}

stat, errStat := os.Lstat(fname)
if errStat != nil {
err = errStat
Expand Down

0 comments on commit e380c7b

Please sign in to comment.