mirror of
https://github.com/johnkerl/miller.git
synced 2026-01-23 02:14:13 +00:00
Do wildcard globbing on Windows (#1362)
* Glob wildcards on Windows * test/cases/globbing/0001
This commit is contained in:
parent
793f52c470
commit
9d1d2e07ca
6 changed files with 23 additions and 1 deletions
|
|
@ -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
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
|
|
|
|||
2
test/cases/globbing/0001/a.csv
Normal file
2
test/cases/globbing/0001/a.csv
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
a,b,c
|
||||
1,2,3
|
||||
|
2
test/cases/globbing/0001/b.csv
Normal file
2
test/cases/globbing/0001/b.csv
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
a,b,c
|
||||
4,5,6
|
||||
|
1
test/cases/globbing/0001/cmd
Normal file
1
test/cases/globbing/0001/cmd
Normal file
|
|
@ -0,0 +1 @@
|
|||
mlr --c2p cat ${CASEDIR}/*.csv
|
||||
0
test/cases/globbing/0001/experr
Normal file
0
test/cases/globbing/0001/experr
Normal file
3
test/cases/globbing/0001/expout
Normal file
3
test/cases/globbing/0001/expout
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
a b c
|
||||
1 2 3
|
||||
4 5 6
|
||||
Loading…
Add table
Add a link
Reference in a new issue