diff options
| author | Tim Allen <screwtape@froup.com> | 2016-10-08 23:06:00 +1100 |
|---|---|---|
| committer | Tim Allen <screwtape@froup.com> | 2016-10-08 23:21:20 +1100 |
| commit | e63c915d694f1dba2eeffb679f3bcfbf9452794d (patch) | |
| tree | cc8cbd1375221a8145fb1ad4e6cba0939cd2a9fd /vis-complete | |
| parent | 9532165df3f7e055d8e4e8fee021fdda96593f46 (diff) | |
| download | vis-e63c915d694f1dba2eeffb679f3bcfbf9452794d.tar.gz vis-e63c915d694f1dba2eeffb679f3bcfbf9452794d.tar.xz | |
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.
Diffstat (limited to 'vis-complete')
| -rwxr-xr-x | vis-complete | 11 |
1 files changed, 9 insertions, 2 deletions
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 | |
