go-shellwords

Parse line as shell words

  • Owner: mattn/go-shellwords
  • Platform:
  • License:: MIT License
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

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)

Main metrics

Overview
Name With Ownermattn/go-shellwords
Primary LanguageGo
Program languageGo (Language Count: 2)
Platform
License:MIT License
所有者活动
Created At2014-06-19 03:04:00
Pushed At2024-08-13 09:28:24
Last Commit At2022-12-24 01:59:20
Release Count13
Last Release Namev1.0.12 (Posted on )
First Release Namev1.0.0 (Posted on )
用户参与
Stargazers Count551
Watchers Count8
Fork Count80
Commits Count119
Has Issues Enabled
Issues Count23
Issue Open Count4
Pull Requests Count28
Pull Requests Open Count3
Pull Requests Close Count5
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private