Skip to content
A Golang library to manipulate strings according to the word parsing rules of the UNIX Bourne shell.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Initial commit Sep 28, 2017
.travis.gofmt.sh init commit Oct 2, 2017
.travis.yml init commit Oct 2, 2017
LICENSE Initial commit Sep 28, 2017
README.md fix readme Oct 2, 2017
shellwords.go init commit Oct 2, 2017
shellwords_test.go init commit Oct 2, 2017

README.md

shellwords

License Build Status Go Report Card codecov GoDoc

A Golang library to manipulate strings according to the word parsing rules of the UNIX Bourne shell.

Installation

go get github.com/Wing924/shellwords

Usage

import "github.com/Wing924/shellwords"
args, err := shellwords.Split("./foo --bar=baz")
// args should be ["./foo", "--bar=baz"]

args, err := shellwords.Split("./foo 'a b c'")
// args should be ["./foo", "a b c"]
line := shellwords.Join([]string{"abc", "d e f"})
// line should be `abc d\ e\ f`
line := shellwords.Escape("./foo 'a b c'")
// line should be `./foo\ \'a\ b\ c\'\"`

Thanks

This is based on go-shellwords and ruby module: rubysl-shellwords

You can’t perform that action at this time.