Awesome Go

shellwords

CategoryMiscellaneous
SubcategoryUncategorized
Stars0

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

About shellwords

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

Frequently Asked Questions

What is shellwords?

shellwords is a Miscellaneous library for the Go programming language. A Golang library to manipulate strings according to the word parsing rules of the UNIX Bourne shell

How do I install shellwords?

Install shellwords with the Go module system using `go get Wing924/shellwords`. Check the repository for the current installation instructions.

What category does shellwords belong to?

shellwords is listed under Miscellaneous, specifically Uncategorized.

← Back to Uncategorized