Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kballard/go-shellquote
Go utilities for performing shell-like word splitting/joining
https://github.com/kballard/go-shellquote
Last synced: 15 days ago
JSON representation
Go utilities for performing shell-like word splitting/joining
- Host: GitHub
- URL: https://github.com/kballard/go-shellquote
- Owner: kballard
- License: mit
- Created: 2012-07-11T04:08:43.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2024-03-23T23:02:30.000Z (8 months ago)
- Last Synced: 2024-09-13T21:44:46.657Z (2 months ago)
- Language: Go
- Size: 9.77 KB
- Stars: 199
- Watchers: 6
- Forks: 41
- Open Issues: 0
-
Metadata Files:
- Readme: README
- License: LICENSE
Awesome Lists containing this project
README
PACKAGE
package shellquote
import "github.com/kballard/go-shellquote"Shellquote provides utilities for joining/splitting strings using sh's
word-splitting rules.VARIABLES
var (
UnterminatedSingleQuoteError = errors.New("Unterminated single-quoted string")
UnterminatedDoubleQuoteError = errors.New("Unterminated double-quoted string")
UnterminatedEscapeError = errors.New("Unterminated backslash-escape")
)FUNCTIONS
func Join(args ...string) string
Join quotes each argument and joins them with a space. If passed to
/bin/sh, the resulting string will be split back into the original
arguments.func Split(input string) (words []string, err error)
Split splits a string according to /bin/sh's word-splitting rules. It
supports backslash-escapes, single-quotes, and double-quotes. Notably it
does not support the $'' style of quoting. It also doesn't attempt to
perform any other sort of expansion, including brace expansion, shell
expansion, or pathname expansion.If the given input has an unterminated quoted string or ends in a
backslash-escape, one of UnterminatedSingleQuoteError,
UnterminatedDoubleQuoteError, or UnterminatedEscapeError is returned.