b9310be6f582

Merge pull request #16 from simono/patch-1

Fix typo :-)
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Wed, 09 Dec 2015 11:53:08 +0000
parents 2bac915ac93d (diff) 11b556fab738 (current diff)
children 0e947252dd46
branches/tags (none)
files

Changes

--- 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)