From 1de6b7e7641f2c0cb101a82385cee569aa786e3f Mon Sep 17 00:00:00 2001 From: Gauvain Pocentek Date: Fri, 13 May 2016 19:07:48 +0200 Subject: implement star/unstar for projects --- gitlab/cli.py | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'gitlab/cli.py') diff --git a/gitlab/cli.py b/gitlab/cli.py index cd64ada..02dac8e 100644 --- a/gitlab/cli.py +++ b/gitlab/cli.py @@ -52,7 +52,10 @@ EXTRA_ACTIONS = { gitlab.ProjectMilestone: {'issues': {'required': ['id', 'project-id']}}, gitlab.Project: {'search': {'required': ['query']}, 'owned': {}, - 'all': {}}, + 'all': {}, + 'starred': {}, + 'star': {'required': ['id']}, + 'unstar': {'required': ['id']}}, gitlab.User: {'block': {'required': ['id']}, 'unblock': {'required': ['id']}, 'search': {'required': ['query']}, @@ -170,12 +173,32 @@ class GitlabCLI(object): except Exception as e: _die("Impossible to list all projects (%s)" % str(e)) + def do_project_starred(self, cls, gl, what, args): + try: + return gl.projects.starred() + except Exception as e: + _die("Impossible to list starred projects (%s)" % str(e)) + def do_project_owned(self, cls, gl, what, args): try: return gl.projects.owned() except Exception as e: _die("Impossible to list owned projects (%s)" % str(e)) + def do_project_star(self, cls, gl, what, args): + try: + o = self.do_get(cls, gl, what, args) + o.star() + except Exception as e: + _die("Impossible to star project (%s)" % str(e)) + + def do_project_unstar(self, cls, gl, what, args): + try: + o = self.do_get(cls, gl, what, args) + o.unstar() + except Exception as e: + _die("Impossible to unstar 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