|
47 | 47 | gitlab.Project: {SEARCH: {'requiredAttrs': ['query']}, |
48 | 48 | OWNED: {'requiredAttrs': []}, |
49 | 49 | ALL: {'requiredAttrs': []}}, |
| 50 | + gitlab.Group: {SEARCH: {'requiredAttrs': ['query']}}, |
50 | 51 | } |
51 | 52 |
|
52 | 53 |
|
@@ -209,23 +210,30 @@ def do_update(cls, gl, what, args): |
209 | 210 | return o |
210 | 211 |
|
211 | 212 |
|
| 213 | +def do_group_search(gl, what, args): |
| 214 | + try: |
| 215 | + return gl.groups.search(args['query']) |
| 216 | + except Exception as e: |
| 217 | + die("Impossible to search projects (%s)" % str(e)) |
| 218 | + |
| 219 | + |
212 | 220 | def do_project_search(gl, what, args): |
213 | 221 | try: |
214 | | - return gl.search_projects(args['query']) |
| 222 | + return gl.projects.search(args['query']) |
215 | 223 | except Exception as e: |
216 | 224 | die("Impossible to search projects (%s)" % str(e)) |
217 | 225 |
|
218 | 226 |
|
219 | 227 | def do_project_all(gl, what, args): |
220 | 228 | try: |
221 | | - return gl.all_projects() |
| 229 | + return gl.projects.all() |
222 | 230 | except Exception as e: |
223 | 231 | die("Impossible to list all projects (%s)" % str(e)) |
224 | 232 |
|
225 | 233 |
|
226 | 234 | def do_project_owned(gl, what, args): |
227 | 235 | try: |
228 | | - return gl.owned_projects() |
| 236 | + return gl.projects.owned() |
229 | 237 | except Exception as e: |
230 | 238 | die("Impossible to list owned projects (%s)" % str(e)) |
231 | 239 |
|
@@ -312,10 +320,15 @@ def main(): |
312 | 320 | getattr(o, action)() |
313 | 321 |
|
314 | 322 | elif action == SEARCH: |
315 | | - if cls != gitlab.Project: |
| 323 | + |
| 324 | + if cls == gitlab.Project: |
| 325 | + l = do_project_search(gl, what, args) |
| 326 | + elif cls == gitlab.Group: |
| 327 | + l = do_group_search(gl, what, args) |
| 328 | + else: |
316 | 329 | die("%s objects don't support this request" % what) |
317 | 330 |
|
318 | | - for o in do_project_search(gl, what, args): |
| 331 | + for o in l: |
319 | 332 | o.display(verbose) |
320 | 333 |
|
321 | 334 | elif action == OWNED: |
|
0 commit comments