From e63c915d694f1dba2eeffb679f3bcfbf9452794d Mon Sep 17 00:00:00 2001 From: Tim Allen Date: Sat, 8 Oct 2016 23:06:00 +1100 Subject: Teach vis-complete that ".." path segments in the prefix are acceptable. Instead of trying to filter out path-segments-beginning-with-dot from the entire path (including the prefix, which would be perfectly legitimate), tell find to prune hidden directories and ignore hidden file as it walks the tree. --- vis-complete | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'vis-complete') diff --git a/vis-complete b/vis-complete index fa5bbf0..43b080f 100755 --- a/vis-complete +++ b/vis-complete @@ -44,9 +44,16 @@ else esac START=$(dirname "$PATTERN") + # The first path condition rules out paths that start with "." unless + # they start with "..". That way, hidden paths should stay hidden, but + # non-normalised paths should still show up. find "$START" \ - ! -path '*/\.*' \ - -a -path "$(glob_quote "$PATTERN")*" 2>/dev/null | + -name '.*' -prune \ + -o \( \ + ! -name '.*' \ + -a -path "$(glob_quote "$PATTERN")*" \ + -print \ + \) 2>/dev/null | head -n $FIND_FILE_LIMIT | sort fi | -- cgit v1.2.3