Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Wing924/shellwords
A Golang library to manipulate strings according to the word parsing rules of the UNIX Bourne shell.
https://github.com/Wing924/shellwords
go golang golang-library
Last synced: 3 months ago
JSON representation
A Golang library to manipulate strings according to the word parsing rules of the UNIX Bourne shell.
- Host: GitHub
- URL: https://github.com/Wing924/shellwords
- Owner: Wing924
- License: apache-2.0
- Created: 2017-09-28T09:08:28.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-04-20T06:25:14.000Z (almost 2 years ago)
- Last Synced: 2024-04-22T13:32:09.906Z (9 months ago)
- Topics: go, golang, golang-library
- Language: Go
- Size: 11.7 KB
- Stars: 23
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-go - shellwords - A Golang library to manipulate strings according to the word parsing rules of the UNIX Bourne shell. (Miscellaneous / Uncategorized)
- zero-alloc-awesome-go - shellwords - A Golang library to manipulate strings according to the word parsing rules of the UNIX Bourne shell. (Miscellaneous / Uncategorized)
- awesome-go - shellwords - A Golang library to manipulate strings according to the word parsing rules of the UNIX Bourne shell. - ★ 3 (Miscellaneous)
- awesome-go-extra - shellwords - 09-28T09:08:28Z|2022-03-15T08:24:38Z| (Microsoft Office / Uncategorized)
- awesome-go-zh - shellwords
README
# shellwords
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![Go Report Card](https://goreportcard.com/badge/github.com/Wing924/shellwords)](https://goreportcard.com/report/github.com/Wing924/shellwords)
[![codecov](https://codecov.io/gh/Wing924/shellwords/branch/master/graph/badge.svg)](https://codecov.io/gh/Wing924/shellwords)
[![GoDoc](https://godoc.org/github.com/Wing924/shellwords?status.svg)](https://godoc.org/github.com/Wing924/shellwords)A Golang library to manipulate strings according to the word parsing rules of the UNIX Bourne shell.
## Installation
```sh
go get github.com/Wing924/shellwords
```## Usage
```go
import "github.com/Wing924/shellwords"
``````go
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"]
``````go
line := shellwords.Join([]string{"abc", "d e f"})
// line should be `abc d\ e\ f`
``````go
line := shellwords.Escape("./foo 'a b c'")
// line should be `./foo\ \'a\ b\ c\'\"`
```## Thanks
This is based on ruby module: [Shellwords](https://github.com/ruby/shellwords)