repositorypackage
0.0.0-20170422170013-bc5ae99f1c2b
Repository: https://github.com/b4b4r07/go-colon.git
Documentation: pkg.go.dev
# README
go-colon

Package colon for parsing colon-separated strings like PATH
Installation
$ go get github.com/b4b4r07/go-colon
Usage
Example
Set the variables as you like 1:
export ENHANCD_FILTER="fzy:/usr/local/bin/peco --select-1:fzf --multi --ansi:zaw"
Run this script like _example
.
result, err := colon.Parse(os.Getenv("ENHANCD_FILTER"))
if err != nil {
panic(err)
}
pp.Println(result.Executable())
Result:
&colon.Result{
colon.Object{
Index: 1,
Attr: colon.Attribute{
First: "fzy",
Other: []string{},
Args: []string{
"fzy",
},
Base: "fzy",
Dir: "",
IsDir: false,
Command: "/Users/b4b4r07/.zplug/bin/fzy",
},
Errors: []error{},
},
colon.Object{
Index: 2,
Attr: colon.Attribute{
First: "/usr/local/bin/peco",
Other: []string{
"--select-1",
},
Args: []string{
"/usr/local/bin/peco",
"--select-1",
},
Base: "peco",
Dir: "/usr/local/bin",
IsDir: false,
Command: "/usr/local/bin/peco",
},
Errors: []error{},
},
colon.Object{
Index: 3,
Attr: colon.Attribute{
First: "fzf",
Other: []string{
"--multi",
"--ansi",
},
Args: []string{
"fzf",
"--multi",
"--ansi",
},
Base: "fzf",
Dir: "",
IsDir: false,
Command: "/Users/b4b4r07/.zplug/bin/fzf",
},
Errors: []error{},
},
}
For more info, see godoc.
License
MIT
Author
b4b4r07