1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
# Argv
[](https://godoc.org/github.com/cosiner/argv)
[](https://travis-ci.org/cosiner/argv)
[](https://coveralls.io/github/cosiner/argv)
[](https://goreportcard.com/report/github.com/cosiner/argv)
Argv is a library for [Go](https://golang.org) to split command line string into arguments array.
# Documentation
Documentation can be found at [Godoc](https://godoc.org/github.com/cosiner/argv)
# Example
```Go
func TestArgv(t *testing.T) {
args, err := argv.Argv([]rune(" ls `echo /` | wc -l "), argv.ParseEnv(os.Environ()), argv.Run)
if err != nil {
t.Fatal(err)
}
expects := [][]string{
[]string{"ls", "/"},
[]string{"wc", "-l"},
}
if !reflect.DeepEqual(args, expects) {
t.Fatal(args)
}
}
```
# LICENSE
MIT.
|