File: README.md

package info (click to toggle)
golang-github-anmitsu-go-shlex 0.0~git20200514.38f4b40-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, experimental, sid
  • size: 80 kB
  • sloc: makefile: 2
file content (45 lines) | stat: -rw-r--r-- 597 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# 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)
    }
}
```
output

    cp
    -Rdp
    file name
    file name2
    dir name

## Documentation

http://godoc.org/github.com/anmitsu/go-shlex