File tree 2 files changed +18
-9
lines changed
2 files changed +18
-9
lines changed Original file line number Diff line number Diff line change @@ -59,8 +59,9 @@ def actionHelpList(cls):
59
59
detail += " "
60
60
detail += "--page=ARG --per-page=ARG"
61
61
elif action in ['get' , 'delete' ]:
62
- detail = "--id=ARG "
63
- detail += " " .join (["--%s=ARG" % x .replace ('_' , '-' ) for x in cls .requiredGetAttrs ])
62
+ if cls not in [gitlab .CurrentUser ]:
63
+ detail = "--id=ARG "
64
+ detail += " " .join (["--%s=ARG" % x .replace ('_' , '-' ) for x in cls .requiredGetAttrs ])
64
65
elif action == 'create' :
65
66
detail = " " .join (["--%s=ARG" % x .replace ('_' , '-' ) for x in cls .requiredCreateAttrs ])
66
67
if detail :
@@ -113,7 +114,7 @@ args = []
113
114
d = {}
114
115
for arg in sys .argv [1 :]:
115
116
if arg .startswith ('--' ):
116
- arg = arg [2 :]. replace ( '-' , '_' )
117
+ arg = arg [2 :]
117
118
118
119
if arg == 'help' :
119
120
usage ()
@@ -122,8 +123,8 @@ for arg in sys.argv[1:]:
122
123
verbose = True
123
124
continue
124
125
125
- k , v = arg .split ('=' , 2 )
126
- k = k .strip ()
126
+ k , v = arg .split ('=' , 1 )
127
+ k = k .strip (). replace ( '_' , '-' )
127
128
v = v .strip ()
128
129
129
130
if k == 'gitlab' :
@@ -219,10 +220,12 @@ elif action == "get":
219
220
if not cls .canGet :
220
221
die ("%s objects can't be retrieved" % what )
221
222
222
- try :
223
- id = d .pop ('id' )
224
- except :
225
- die ("Missing --id argument" )
223
+ id = None
224
+ if cls not in [gitlab .CurrentUser ]:
225
+ try :
226
+ id = d .pop ('id' )
227
+ except :
228
+ die ("Missing --id argument" )
226
229
227
230
try :
228
231
o = cls (gl , id , ** d )
Original file line number Diff line number Diff line change @@ -278,6 +278,9 @@ def create(self, obj):
278
278
url = obj ._url % obj .__dict__
279
279
url = '%s%s?private_token=%s' % (self ._url , url , self .private_token )
280
280
281
+ print url
282
+ print obj .__dict__
283
+
281
284
try :
282
285
# TODO: avoid too much work on the server side by filtering the
283
286
# __dict__ keys
@@ -529,6 +532,8 @@ class User(GitlabObject):
529
532
class CurrentUserKey (GitlabObject ):
530
533
_url = '/user/keys'
531
534
canUpdate = False
535
+ shortPrintAttr = 'title'
536
+ requiredCreateAttrs = ['title' , 'key' ]
532
537
533
538
534
539
class CurrentUser (GitlabObject ):
@@ -537,6 +542,7 @@ class CurrentUser(GitlabObject):
537
542
canCreate = False
538
543
canUpdate = False
539
544
canDelete = False
545
+ shortPrintAttr = 'username'
540
546
541
547
def Key (self , id = None , ** kwargs ):
542
548
if id is None :
You can’t perform that action at this time.
0 commit comments