Skip to content

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

License

Notifications You must be signed in to change notification settings

Wing924/shellwords

Repository files navigation

shellwords

License 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 ruby module: Shellwords

About

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

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages