File tree 1 file changed +7
-5
lines changed
1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -87,7 +87,9 @@ def populate_sub_parser_by_class(cls, sub_parser):
87
87
88
88
elif action_name in [GET , DELETE ]:
89
89
if cls not in [gitlab .CurrentUser ]:
90
- sub_parser_action .add_argument ("--id" , required = True )
90
+ id_attr = cls .idAttr .replace ('_' , '-' )
91
+ sub_parser_action .add_argument ("--%s" % id_attr ,
92
+ required = True )
91
93
[sub_parser_action .add_argument ("--%s" % x .replace ('_' , '-' ),
92
94
required = True )
93
95
for x in cls .requiredGetAttrs ]
@@ -126,11 +128,11 @@ def do_auth():
126
128
die ("Could not connect to GitLab %s (%s)" % (gitlab_url , str (e )))
127
129
128
130
129
- def get_id ():
131
+ def get_id (cls ):
130
132
try :
131
- id = d .pop ('id' )
133
+ id = d .pop (cls . idAttr )
132
134
except Exception :
133
- die ("Missing --id argument" )
135
+ die ("Missing --%s argument" % cls . idAttr . replace ( '_' , '-' ) )
134
136
135
137
return id
136
138
@@ -166,7 +168,7 @@ def do_get(cls, d):
166
168
167
169
id = None
168
170
if cls not in [gitlab .CurrentUser ]:
169
- id = get_id ()
171
+ id = get_id (cls )
170
172
171
173
try :
172
174
o = cls (gl , id , ** d )
You can’t perform that action at this time.
0 commit comments