summaryrefslogtreecommitdiff
path: root/gitlab/cli.py
diff options
context:
space:
mode:
authorGauvain Pocentek <gauvain@pocentek.net>2016-02-14 10:40:12 +0100
committerGauvain Pocentek <gauvain@pocentek.net>2016-02-14 10:40:14 +0100
commit58433d2b1854eb4e112c499d52d8dd0fd6dba094 (patch)
treef5f88ff6d8a665ac89c39b61fc37ca8350688c7b /gitlab/cli.py
parent7260684d11e8ffe02461f761b6677d039b703a8d (diff)
downloadgitlab-58433d2b1854eb4e112c499d52d8dd0fd6dba094.tar.gz
CI: implement user get-by-username
fixes #95
Diffstat (limited to 'gitlab/cli.py')
-rw-r--r--gitlab/cli.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/gitlab/cli.py b/gitlab/cli.py
index 0e7d5ef..090978b 100644
--- a/gitlab/cli.py
+++ b/gitlab/cli.py
@@ -47,7 +47,8 @@ EXTRA_ACTIONS = {
'all': {}},
gitlab.User: {'block': {'required': ['id']},
'unblock': {'required': ['id']},
- 'search': {'required': ['query']}},
+ 'search': {'required': ['query']},
+ 'get-by-username': {'required': ['query']}},
}
@@ -229,6 +230,12 @@ class GitlabCLI(object):
except Exception as e:
_die("Impossible to search users (%s)" % str(e))
+ def do_user_getbyusername(self, cls, gl, what, args):
+ try:
+ return gl.users.search(args['query'])
+ except Exception as e:
+ _die("Impossible to get user %s (%s)" % (args['query'], str(e)))
+
def _populate_sub_parser_by_class(cls, sub_parser):
for action_name in ['list', 'get', 'create', 'update', 'delete']:
@@ -370,7 +377,7 @@ def main():
cli = GitlabCLI()
method = None
what = what.replace('-', '_')
- action = action.lower()
+ action = action.lower().replace('-', '')
for test in ["do_%s_%s" % (what, action),
"do_%s" % action]:
if hasattr(cli, test):