summaryrefslogtreecommitdiff
path: root/gitlab
diff options
context:
space:
mode:
authorGauvain Pocentek <gauvain@pocentek.net>2013-06-22 10:39:37 +0200
committerGauvain Pocentek <gauvain@pocentek.net>2013-06-22 10:39:37 +0200
commit4c998eaa2a58efa25ae08bfe084c3ef76df98644 (patch)
tree94acb552f8281480ea4689d209f3b3dc6440f153 /gitlab
parenta7f206570b2a1a4104a9d6017c9b594fb3e93e13 (diff)
downloadgitlab-4c998eaa2a58efa25ae08bfe084c3ef76df98644.tar.gz
gitlab: make the current-user option work
Diffstat (limited to 'gitlab')
-rwxr-xr-xgitlab21
1 files changed, 12 insertions, 9 deletions
diff --git a/gitlab b/gitlab
index c5b8f63..3e98666 100755
--- a/gitlab
+++ b/gitlab
@@ -59,8 +59,9 @@ def actionHelpList(cls):
detail += " "
detail += "--page=ARG --per-page=ARG"
elif action in ['get', 'delete']:
- detail = "--id=ARG "
- detail += " ".join(["--%s=ARG" % x.replace('_', '-') for x in cls.requiredGetAttrs])
+ if cls not in [gitlab.CurrentUser]:
+ detail = "--id=ARG "
+ detail += " ".join(["--%s=ARG" % x.replace('_', '-') for x in cls.requiredGetAttrs])
elif action == 'create':
detail = " ".join(["--%s=ARG" % x.replace('_', '-') for x in cls.requiredCreateAttrs])
if detail:
@@ -113,7 +114,7 @@ args = []
d = {}
for arg in sys.argv[1:]:
if arg.startswith('--'):
- arg = arg[2:].replace('-', '_')
+ arg = arg[2:]
if arg == 'help':
usage()
@@ -122,8 +123,8 @@ for arg in sys.argv[1:]:
verbose = True
continue
- k, v = arg.split('=', 2)
- k = k.strip()
+ k, v = arg.split('=', 1)
+ k = k.strip().replace('_', '-')
v = v.strip()
if k == 'gitlab':
@@ -219,10 +220,12 @@ elif action == "get":
if not cls.canGet:
die("%s objects can't be retrieved" % what)
- try:
- id = d.pop('id')
- except:
- die("Missing --id argument")
+ id = None
+ if cls not in [gitlab.CurrentUser]:
+ try:
+ id = d.pop('id')
+ except:
+ die("Missing --id argument")
try:
o = cls(gl, id, **d)