Commits

Alexander Solovyov committed 546f2c9

do not fail if eliminate is empty

  • Participants
  • Parent commits ae0513f

Comments (0)

Files changed (1)

  • +3 -2
    sr
         if opts.ignore_case:
             flags |= re.I
         config.search = re.compile(config.search, flags)
-        config.eliminate = re.compile(opts.eliminate, flags)
+        config.eliminate = opts.eliminate and re.compile(opts.eliminate, flags)
 
 def relpath(path):
     curpath = os.getcwd() + '/'
     return path
 
 def search_line(line):
-    return config.search.search(line) and not config.eliminate.search(line)
+    eliminate = config.eliminate and config.eliminate.search(line) or False
+    return config.search.search(line) and not eliminate
 
 def search(path):
     """