# HG changeset patch # User Steve Losh # Date 1449661988 0 # Node ID b9310be6f582869933bcf9c161f490f8258036df # Parent 2bac915ac93df28be6ac476690d3f87c9f5ddacc# Parent 11b556fab7389f3ce2f885dd1ae96280c0a07ba7 Merge pull request #16 from simono/patch-1 Fix typo :-) diff -r 11b556fab738 -r b9310be6f582 ffind --- a/ffind Thu Mar 06 01:04:35 2014 +0100 +++ b/ffind Wed Dec 09 11:53:08 2015 +0000 @@ -189,7 +189,7 @@ # If you can't tell what the hell this means you're not alone, because git's # documentation is fucking inscrutable. Here's what I've come up with from # trial and error: - # + # # 0. Patterns ending in a slash will only match directories, and then you # can ignore that slash for the rest of these rules. # 1. Patterns are shell globs, except * doesn't match / and there's no **. @@ -381,6 +381,9 @@ ignorers.extend(parse_hgignore_file(target)) return ignorers +def parse_ignore_args(): + return [compile_ff_glob(pattern) for pattern in options.ignore] + def get_initial_ignorers(): if '.ffignore' in options.ignore_files: @@ -460,9 +463,13 @@ def _search(query, dir, depth, ignorers): - ignorers = ignorers + parse_ignore_files(dir) + ignorers = ignorers + parse_ignore_files(dir) + parse_ignore_args() - contents = os.listdir(dir) + try: + contents = os.listdir(dir) + except OSError: + err('Error: `' + dir + '`: Permission denied') + return next = [] for item in contents: @@ -565,7 +572,7 @@ help="don't ignore anything (ALL files can match)") g.add_option('-I', '--ignore', metavar='PATTERN', - action='append', + action='append', default=[], help="add a pattern to be ignored (can be given multiple times)") p.add_option_group(g)