summaryrefslogtreecommitdiff
path: root/gitlab/cli.py
diff options
context:
space:
mode:
authorGauvain Pocentek <gauvain@pocentek.net>2016-05-13 19:07:48 +0200
committerGauvain Pocentek <gauvain@pocentek.net>2016-05-13 19:07:48 +0200
commit1de6b7e7641f2c0cb101a82385cee569aa786e3f (patch)
tree832c5258a16d2c83e70a243db8c1b623bfa89959 /gitlab/cli.py
parent24c283f5861f21e51489afc815bd9f31bff58bee (diff)
downloadgitlab-1de6b7e7641f2c0cb101a82385cee569aa786e3f.tar.gz
implement star/unstar for projects
Diffstat (limited to 'gitlab/cli.py')
-rw-r--r--gitlab/cli.py25
1 files changed, 24 insertions, 1 deletions
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)