github.com/divan/complete@v0.0.0-20170515130636-337e95201af7/match/file.go (about) 1 package match 2 3 import "strings" 4 5 // File returns true if prefix can match the file 6 func File(file, prefix string) bool { 7 8 // special case for current directory completion 9 if file == "./" && (prefix == "." || prefix == "") { 10 return true 11 } 12 13 file = strings.TrimPrefix(file, "./") 14 prefix = strings.TrimPrefix(prefix, "./") 15 return strings.HasPrefix(file, prefix) 16 }