github.com/hoop33/elvish@v0.0.0-20160801152013-6d25485beab4/eval/search.go (about) 1 package eval 2 3 import ( 4 "fmt" 5 6 "github.com/elves/elvish/parse" 7 "github.com/elves/elvish/util" 8 ) 9 10 // Search tries to resolve an external command and return the full (possibly 11 // relative) path. 12 func (ev *Evaler) Search(exe string) (string, error) { 13 path, err := util.Search(ev.searchPaths(), exe) 14 if err != nil { 15 return "", fmt.Errorf("search %s: %s", parse.Quote(exe), err.Error()) 16 } 17 return path, nil 18 } 19 20 // AllExecutables writes the names of all executable files in the search path 21 // to a channel. 22 func (ev *Evaler) AllExecutables(names chan<- string) { 23 util.AllExecutables(ev.searchPaths(), names) 24 }