|
47 | 47 | 'all': {}},
|
48 | 48 | gitlab.User: {'block': {'required': ['id']},
|
49 | 49 | 'unblock': {'required': ['id']},
|
50 |
| - 'search': {'required': ['query']}}, |
| 50 | + 'search': {'required': ['query']}, |
| 51 | + 'get-by-username': {'required': ['query']}}, |
51 | 52 | }
|
52 | 53 |
|
53 | 54 |
|
@@ -229,6 +230,12 @@ def do_user_search(self, cls, gl, what, args):
|
229 | 230 | except Exception as e:
|
230 | 231 | _die("Impossible to search users (%s)" % str(e))
|
231 | 232 |
|
| 233 | + def do_user_getbyusername(self, cls, gl, what, args): |
| 234 | + try: |
| 235 | + return gl.users.search(args['query']) |
| 236 | + except Exception as e: |
| 237 | + _die("Impossible to get user %s (%s)" % (args['query'], str(e))) |
| 238 | + |
232 | 239 |
|
233 | 240 | def _populate_sub_parser_by_class(cls, sub_parser):
|
234 | 241 | for action_name in ['list', 'get', 'create', 'update', 'delete']:
|
@@ -370,7 +377,7 @@ def main():
|
370 | 377 | cli = GitlabCLI()
|
371 | 378 | method = None
|
372 | 379 | what = what.replace('-', '_')
|
373 |
| - action = action.lower() |
| 380 | + action = action.lower().replace('-', '') |
374 | 381 | for test in ["do_%s_%s" % (what, action),
|
375 | 382 | "do_%s" % action]:
|
376 | 383 | if hasattr(cli, test):
|
|
0 commit comments