README 1.2 KB

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