File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
Expand file tree Collapse file tree 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):
8787
8888 elif action_name in [GET , DELETE ]:
8989 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 )
9193 [sub_parser_action .add_argument ("--%s" % x .replace ('_' , '-' ),
9294 required = True )
9395 for x in cls .requiredGetAttrs ]
@@ -126,11 +128,11 @@ def do_auth():
126128 die ("Could not connect to GitLab %s (%s)" % (gitlab_url , str (e )))
127129
128130
129- def get_id ():
131+ def get_id (cls ):
130132 try :
131- id = d .pop ('id' )
133+ id = d .pop (cls . idAttr )
132134 except Exception :
133- die ("Missing --id argument" )
135+ die ("Missing --%s argument" % cls . idAttr . replace ( '_' , '-' ) )
134136
135137 return id
136138
@@ -166,7 +168,7 @@ def do_get(cls, d):
166168
167169 id = None
168170 if cls not in [gitlab .CurrentUser ]:
169- id = get_id ()
171+ id = get_id (cls )
170172
171173 try :
172174 o = cls (gl , id , ** d )
You can’t perform that action at this time.
0 commit comments