diff options
Diffstat (limited to 'command.py')
-rw-r--r-- | command.py | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -193,14 +193,20 @@ class Command(object): | |||
193 | result.sort(key=_getpath) | 193 | result.sort(key=_getpath) |
194 | return result | 194 | return result |
195 | 195 | ||
196 | def FindProjects(self, args): | 196 | def FindProjects(self, args, inverse=False): |
197 | result = [] | 197 | result = [] |
198 | patterns = [re.compile(r'%s' % a, re.IGNORECASE) for a in args] | 198 | patterns = [re.compile(r'%s' % a, re.IGNORECASE) for a in args] |
199 | for project in self.GetProjects(''): | 199 | for project in self.GetProjects(''): |
200 | for pattern in patterns: | 200 | for pattern in patterns: |
201 | if pattern.search(project.name) or pattern.search(project.relpath): | 201 | match = pattern.search(project.name) or pattern.search(project.relpath) |
202 | if not inverse and match: | ||
202 | result.append(project) | 203 | result.append(project) |
203 | break | 204 | break |
205 | if inverse and match: | ||
206 | break | ||
207 | else: | ||
208 | if inverse: | ||
209 | result.append(project) | ||
204 | result.sort(key=lambda project: project.relpath) | 210 | result.sort(key=lambda project: project.relpath) |
205 | return result | 211 | return result |
206 | 212 | ||