diff --git a/.golangci.yml b/.golangci.yml index 393c267..0ddefab 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -19,11 +19,22 @@ linters: - goimports - goprintffuncname - govet - - interfacer - misspell - nolintlint - - scopelint + - exportloopref - typecheck - unconvert - unparam - whitespace + +linters-settings: + depguard: + rules: + main: + allow: + - $gostd + - github.com + test: + allow: + - $gostd + - github.com \ No newline at end of file diff --git a/commands.go b/commands.go index 13cf522..26651d1 100644 --- a/commands.go +++ b/commands.go @@ -368,8 +368,12 @@ func NewUploadCommand() cli.Command { if c.Int("w") > 10 || c.Int("w") < 1 { PrintErrorAndExit("max concurrent threads must between (1 - 10)") } + filenames := c.Args() + if isWindowsGOOS() { + filenames = globFiles(filenames) + } session.Upload( - c.Args(), + filenames, c.String("remote"), c.Int("w"), c.Bool("all"), diff --git a/utils.go b/utils.go index 28d9906..013944e 100644 --- a/utils.go +++ b/utils.go @@ -5,6 +5,8 @@ import ( "fmt" "io" "os" + "path/filepath" + "runtime" "strconv" "strings" "time" @@ -140,3 +142,18 @@ func contains(slice []string, item string) bool { } return false } + +func globFiles(patterns []string) []string { + filenames := make([]string, 0) + for _, filename := range patterns { + matches, err := filepath.Glob(filename) + if err == nil { + filenames = append(filenames, matches...) + } + } + return filenames +} + +func isWindowsGOOS() bool { + return runtime.GOOS == "windows" +}