mirror of
https://github.com/go-gitea/gitea.git
synced 2024-12-05 09:03:48 +08:00
d0ec940dd7
resolves git conflicts from #3896 (credit to @belak, in case github doesn't keep original author during squash) Co-Authored-By: Matti Ranta <techknowlogick@gitea.io>
39 lines
531 B
Markdown
Vendored
39 lines
531 B
Markdown
Vendored
# go-shlex
|
|
|
|
go-shlex is a library to make a lexical analyzer like Unix shell for
|
|
Go.
|
|
|
|
## Install
|
|
|
|
go get -u "github.com/anmitsu/go-shlex"
|
|
|
|
## Usage
|
|
|
|
```go
|
|
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
|
|
"github.com/anmitsu/go-shlex"
|
|
)
|
|
|
|
func main() {
|
|
cmd := `cp -Rdp "file name" 'file name2' dir\ name`
|
|
words, err := shlex.Split(cmd, true)
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
for _, w := range words {
|
|
fmt.Println(w)
|
|
}
|
|
}
|
|
```
|
|
|
|
## Documentation
|
|
|
|
http://godoc.org/github.com/anmitsu/go-shlex
|
|
|