README (1243B)
1 PACKAGE 2 3 package shellquote 4 import "github.com/kballard/go-shellquote" 5 6 Shellquote provides utilities for joining/splitting strings using sh's 7 word-splitting rules. 8 9 VARIABLES 10 11 var ( 12 UnterminatedSingleQuoteError = errors.New("Unterminated single-quoted string") 13 UnterminatedDoubleQuoteError = errors.New("Unterminated double-quoted string") 14 UnterminatedEscapeError = errors.New("Unterminated backslash-escape") 15 ) 16 17 18 FUNCTIONS 19 20 func Join(args ...string) string 21 Join quotes each argument and joins them with a space. If passed to 22 /bin/sh, the resulting string will be split back into the original 23 arguments. 24 25 func Split(input string) (words []string, err error) 26 Split splits a string according to /bin/sh's word-splitting rules. It 27 supports backslash-escapes, single-quotes, and double-quotes. Notably it 28 does not support the $'' style of quoting. It also doesn't attempt to 29 perform any other sort of expansion, including brace expansion, shell 30 expansion, or pathname expansion. 31 32 If the given input has an unterminated quoted string or ends in a 33 backslash-escape, one of UnterminatedSingleQuoteError, 34 UnterminatedDoubleQuoteError, or UnterminatedEscapeError is returned. 35 36