1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-11-27 09:11:53 -05:00
forgejo/vendor/github.com/anmitsu/go-shlex
techknowlogick d0ec940dd7
switch to use gliderlabs/ssh for builtin server (#7250)
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>
2019-07-06 21:28:09 -04:00
..
.gitignore switch to use gliderlabs/ssh for builtin server (#7250) 2019-07-06 21:28:09 -04:00
LICENSE switch to use gliderlabs/ssh for builtin server (#7250) 2019-07-06 21:28:09 -04:00
README.md switch to use gliderlabs/ssh for builtin server (#7250) 2019-07-06 21:28:09 -04:00
shlex.go switch to use gliderlabs/ssh for builtin server (#7250) 2019-07-06 21:28:09 -04:00

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