cloudflared-mirror/vendor/github.com/anmitsu/go-shlex
Austin Cherry 30c9e2af9b AUTH-1941: Adds initial SSH server implementation 2019-08-21 15:49:03 -05:00
..
.gitignore AUTH-1941: Adds initial SSH server implementation 2019-08-21 15:49:03 -05:00
LICENSE AUTH-1941: Adds initial SSH server implementation 2019-08-21 15:49:03 -05:00
README.md AUTH-1941: Adds initial SSH server implementation 2019-08-21 15:49:03 -05:00
shlex.go AUTH-1941: Adds initial SSH server implementation 2019-08-21 15:49:03 -05:00

README.md

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

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