From c05a33a751cb787a3dcd3eaab0de30de7542e24a Mon Sep 17 00:00:00 2001 From: Gokcehan Date: Tue, 16 Aug 2016 23:17:19 +0300 Subject: [PATCH] handle symlinks in shell completion --- comp.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/comp.go b/comp.go index b908c73..a38a05a 100644 --- a/comp.go +++ b/comp.go @@ -4,6 +4,7 @@ import ( "io/ioutil" "log" "os" + "path" "strings" ) @@ -68,6 +69,11 @@ func matchExec(s string) string { for _, f := range fi { if strings.HasPrefix(f.Name(), s) { + f, err = os.Stat(path.Join(p, f.Name())) + if err != nil { + log.Print(err) + } + if !f.Mode().IsRegular() || f.Mode()&0111 == 0 { continue }