From fc68e9bbf8cf24eca4faf57997f0c7273944eabe Mon Sep 17 00:00:00 2001 From: Gauvain Pocentek Date: Sat, 16 Jul 2016 19:56:22 +0200 Subject: implement CLI for project archive/unarchive/share --- gitlab/cli.py | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'gitlab/cli.py') diff --git a/gitlab/cli.py b/gitlab/cli.py index bc17915..e8bb425 100644 --- a/gitlab/cli.py +++ b/gitlab/cli.py @@ -61,7 +61,10 @@ EXTRA_ACTIONS = { 'all': {}, 'starred': {}, 'star': {'required': ['id']}, - 'unstar': {'required': ['id']}}, + 'unstar': {'required': ['id']}, + 'archive': {'required': ['id']}, + 'unarchive': {'required': ['id']}, + 'share': {'required': ['id', 'group-id', 'group-access']}}, gitlab.User: {'block': {'required': ['id']}, 'unblock': {'required': ['id']}, 'search': {'required': ['query']}, @@ -205,6 +208,27 @@ class GitlabCLI(object): except Exception as e: _die("Impossible to unstar project (%s)" % str(e)) + def do_project_archive(self, cls, gl, what, args): + try: + o = self.do_get(cls, gl, what, args) + o.archive_() + except Exception as e: + _die("Impossible to archive project (%s)" % str(e)) + + def do_project_unarchive(self, cls, gl, what, args): + try: + o = self.do_get(cls, gl, what, args) + o.unarchive_() + except Exception as e: + _die("Impossible to unarchive project (%s)" % str(e)) + + def do_project_share(self, cls, gl, what, args): + try: + o = self.do_get(cls, gl, what, args) + o.share(args['group_id'], args['group_access']) + except Exception as e: + _die("Impossible to share project (%s)" % str(e)) + def do_user_block(self, cls, gl, what, args): try: o = self.do_get(cls, gl, what, args) -- cgit v1.2.1