elvish/edit/isexternal.go
2016-02-12 13:31:24 +01:00

19 lines
423 B
Go

package edit
import "github.com/elves/elvish/eval"
// getIsExternal finds a set of all external commands and puts it on the result
// channel.
func getIsExternal(ev *eval.Evaler, result chan<- map[string]bool) {
names := make(chan string, 32)
go func() {
ev.AllExecutables(names)
close(names)
}()
isExternal := make(map[string]bool)
for name := range names {
isExternal[name] = true
}
result <- isExternal
}