kaniko/vendor/github.com/mattn/go-shellwords
Josh Chorlton 57ab7e03f1 bump go-containerregistry dep 2020-08-04 19:41:26 -07:00
..
.travis.yml bump go-containerregistry dep 2020-08-04 19:41:26 -07:00
LICENSE Updated vendor for exported BuildArgs 2018-05-09 11:56:32 -07:00
README.md bump go-containerregistry dep 2020-08-04 19:41:26 -07:00
go.mod bump go-containerregistry dep 2020-08-04 19:41:26 -07:00
go.test.sh bump go-containerregistry dep 2020-08-04 19:41:26 -07:00
shellwords.go bump go-containerregistry dep 2020-08-04 19:41:26 -07:00
util_posix.go bump go-containerregistry dep 2020-08-04 19:41:26 -07:00
util_windows.go bump go-containerregistry dep 2020-08-04 19:41:26 -07:00

README.md

go-shellwords

codecov Build Status GoDoc

Parse line as shell words.

Usage

args, err := shellwords.Parse("./foo --bar=baz")
// args should be ["./foo", "--bar=baz"]
os.Setenv("FOO", "bar")
p := shellwords.NewParser()
p.ParseEnv = true
args, err := p.Parse("./foo $FOO")
// args should be ["./foo", "bar"]
p := shellwords.NewParser()
p.ParseBacktick = true
args, err := p.Parse("./foo `echo $SHELL`")
// args should be ["./foo", "/bin/bash"]
shellwords.ParseBacktick = true
p := shellwords.NewParser()
args, err := p.Parse("./foo `echo $SHELL`")
// args should be ["./foo", "/bin/bash"]

Thanks

This is based on cpan module Parse::CommandLine.

License

under the MIT License: http://mattn.mit-license.org/2017

Author

Yasuhiro Matsumoto (a.k.a mattn)