Refactor FilePathCompleter

This commit is contained in:
c-bata 2018-06-24 18:08:06 +09:00
parent f119db91a1
commit d360b4d498
2 changed files with 4 additions and 2 deletions

@ -16,7 +16,7 @@ func executor(in string) {
func main() {
c := completer.FilePathCompleter{
IgnoreCase: true,
Filter: func(fi os.FileInfo, filename string) bool {
Filter: func(fi os.FileInfo) bool {
return fi.IsDir() || strings.HasSuffix(fi.Name(), ".go")
},
}

@ -16,8 +16,10 @@ var (
)
// FilePathCompleter is a completer for your local file system.
// Please caution that you need to set OptionCompletionWordSeparator(completer.FilePathCompletionSeparator)
// when you use this completer.
type FilePathCompleter struct {
Filter func(fi os.FileInfo, filename string) bool
Filter func(fi os.FileInfo) bool
IgnoreCase bool
fileListCache map[string][]prompt.Suggest
}