You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
531 B

  1. # go-shlex
  2. go-shlex is a library to make a lexical analyzer like Unix shell for
  3. Go.
  4. ## Install
  5. go get -u "github.com/anmitsu/go-shlex"
  6. ## Usage
  7. ```go
  8. package main
  9. import (
  10. "fmt"
  11. "log"
  12. "github.com/anmitsu/go-shlex"
  13. )
  14. func main() {
  15. cmd := `cp -Rdp "file name" 'file name2' dir\ name`
  16. words, err := shlex.Split(cmd, true)
  17. if err != nil {
  18. log.Fatal(err)
  19. }
  20. for _, w := range words {
  21. fmt.Println(w)
  22. }
  23. }
  24. ```
  25. ## Documentation
  26. http://godoc.org/github.com/anmitsu/go-shlex