|
|
@ -162,6 +162,7 @@ def detect_smartcase(needles):
|
|
|
|
|
|
|
|
|
|
|
|
def find_matches(entries, needles, check_entries=True):
|
|
|
|
def find_matches(entries, needles, check_entries=True):
|
|
|
|
"""Return an iterator to matching entries."""
|
|
|
|
"""Return an iterator to matching entries."""
|
|
|
|
|
|
|
|
# TODO(ting|2014-02-18): replace assertion with test
|
|
|
|
assert isinstance(needles, list), "Needles must be a list."
|
|
|
|
assert isinstance(needles, list), "Needles must be a list."
|
|
|
|
ignore_case = detect_smartcase(needles)
|
|
|
|
ignore_case = detect_smartcase(needles)
|
|
|
|
|
|
|
|
|
|
|
@ -185,16 +186,14 @@ def find_matches(entries, needles, check_entries=True):
|
|
|
|
reverse=True)
|
|
|
|
reverse=True)
|
|
|
|
|
|
|
|
|
|
|
|
return ifilter(
|
|
|
|
return ifilter(
|
|
|
|
not_cwd,
|
|
|
|
lambda entry: not_cwd(entry) and exists(entry),
|
|
|
|
ifilter(
|
|
|
|
|
|
|
|
exists,
|
|
|
|
|
|
|
|
chain(
|
|
|
|
chain(
|
|
|
|
match_consecutive(needles, data, ignore_case),
|
|
|
|
match_consecutive(needles, data, ignore_case),
|
|
|
|
match_fuzzy(needles, data, ignore_case),
|
|
|
|
match_fuzzy(needles, data, ignore_case),
|
|
|
|
match_anywhere(needles, data, ignore_case),
|
|
|
|
match_anywhere(needles, data, ignore_case),
|
|
|
|
# default return value so calling shell functions have an
|
|
|
|
# default return value so calling shell functions have an
|
|
|
|
# argument to `cd` to
|
|
|
|
# argument to `cd` to
|
|
|
|
[Entry('.', 0)])))
|
|
|
|
[Entry('.', 0)]))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def handle_tab_completion(needle, entries):
|
|
|
|
def handle_tab_completion(needle, entries):
|
|
|
|