Skip to content

Gioyik/shellparse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ShellParse

Parse line as shell words.

Usage

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

Credits

This is based on cpan module Parse::CommandLine.

About

parse args as shell commands

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages