Skip to content

Commit 5578bdc

Browse files
committed
Allow filtering of directories
Fixes prompt-toolkit#294
1 parent c597adc commit 5578bdc

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

prompt_toolkit/contrib/completers/filesystem.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,11 @@ def get_completions(self, document, complete_event):
8080
# (We don't add them to the `completion`. Users can type it
8181
# to trigger the autocompletion themself.)
8282
filename += '/'
83-
else:
84-
if self.only_directories or not self.file_filter(full_name):
85-
continue
83+
elif self.only_directories:
84+
continue
85+
86+
if not self.file_filter(full_name):
87+
continue
8688

8789
yield Completion(completion, 0, display=filename)
8890
except OSError:

0 commit comments

Comments
 (0)