LearnGO/go/pkg/mod/github.com/cosiner/argv@v0.1.0/argv.go
2024-09-19 21:38:24 -04:00

11 lines
507 B
Go

// Package argv parse command line string into arguments array using the bash syntax.
package argv
// Argv split cmdline string as array of argument array by the '|' character.
//
// The parsing rules is same as bash. The environment variable will be replaced
// and string surround by '`' will be passed to reverse quote parser.
func Argv(cmdline string, backquoteExpander, stringExpander Expander) ([][]string, error) {
return NewParser(NewScanner(cmdline), backquoteExpander, stringExpander).Parse()
}