diff --git a/internal/pkg/platform/getargs_windows.go b/internal/pkg/platform/getargs_windows.go index 536a6288e..4349e4346 100644 --- a/internal/pkg/platform/getargs_windows.go +++ b/internal/pkg/platform/getargs_windows.go @@ -11,6 +11,7 @@ package platform import ( "fmt" "os" + "path/filepath" "strings" shellquote "github.com/kballard/go-shellquote" @@ -76,7 +77,20 @@ func GetArgs() []string { } } //printArgs(retargs, "NEW") - return retargs + + globbed := make([]string, 0) + for i, _ := range retargs { + // Expand things like *.csv + matches, err := filepath.Glob(retargs[i]) + if matches != nil && err == nil { + globbed = append(globbed, matches...) + } else { + globbed = append(globbed, retargs[i]) + } + } + //printArgs(globbed, "NEW") + + return globbed } // ---------------------------------------------------------------- diff --git a/test/cases/globbing/0001/a.csv b/test/cases/globbing/0001/a.csv new file mode 100644 index 000000000..bfde6bfa0 --- /dev/null +++ b/test/cases/globbing/0001/a.csv @@ -0,0 +1,2 @@ +a,b,c +1,2,3 diff --git a/test/cases/globbing/0001/b.csv b/test/cases/globbing/0001/b.csv new file mode 100644 index 000000000..a9411aa9d --- /dev/null +++ b/test/cases/globbing/0001/b.csv @@ -0,0 +1,2 @@ +a,b,c +4,5,6 diff --git a/test/cases/globbing/0001/cmd b/test/cases/globbing/0001/cmd new file mode 100644 index 000000000..a5eecc577 --- /dev/null +++ b/test/cases/globbing/0001/cmd @@ -0,0 +1 @@ +mlr --c2p cat ${CASEDIR}/*.csv diff --git a/test/cases/globbing/0001/experr b/test/cases/globbing/0001/experr new file mode 100644 index 000000000..e69de29bb diff --git a/test/cases/globbing/0001/expout b/test/cases/globbing/0001/expout new file mode 100644 index 000000000..d0c04ad13 --- /dev/null +++ b/test/cases/globbing/0001/expout @@ -0,0 +1,3 @@ +a b c +1 2 3 +4 5 6