Skip to content

Commit

Permalink
Merge pull request #421 from jolheiser/wildcard
Browse files Browse the repository at this point in the history
Add wildcard support for files
  • Loading branch information
schollz authored Oct 2, 2021
2 parents 55cb35d + e380c7b commit 914d0c9
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 914d0c9

Please sign in to comment.