Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf5f734e

Browse files
author
Gauvain Pocentek
committed
CLI: add support for project all --all
Rework the extra opts definition to allow setting typed arguments.Fixes#153
1 parente64d0b9 commitf5f734e

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

‎gitlab/cli.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
gitlab.ProjectMilestone: {'issues': {'required': ['id','project-id']}},
5959
gitlab.Project: {'search': {'required': ['query']},
6060
'owned': {},
61-
'all': {},
61+
'all': {'optional': [('all',bool)]},
6262
'starred': {},
6363
'star': {'required': ['id']},
6464
'unstar': {'required': ['id']},
@@ -181,7 +181,7 @@ def do_project_search(self, cls, gl, what, args):
181181

182182
defdo_project_all(self,cls,gl,what,args):
183183
try:
184-
returngl.projects.all()
184+
returngl.projects.all(all=args['all'])
185185
exceptExceptionase:
186186
_die("Impossible to list all projects",e)
187187

@@ -430,12 +430,21 @@ def _populate_sub_parser_by_class(cls, sub_parser):
430430
forxinattrs]
431431

432432
ifclsinEXTRA_ACTIONS:
433+
def_add_arg(parser,required,data):
434+
extra_args= {}
435+
ifisinstance(data,tuple):
436+
ifdata[1]isbool:
437+
extra_args= {'action':'store_true'}
438+
data=data[0]
439+
440+
parser.add_argument("--%s"%data,required=required,**extra_args)
441+
433442
foraction_nameinsorted(EXTRA_ACTIONS[cls]):
434443
sub_parser_action=sub_parser.add_parser(action_name)
435444
d=EXTRA_ACTIONS[cls][action_name]
436-
[sub_parser_action.add_argument("--%s"%arg,required=True)
445+
[_add_arg(sub_parser_action,True,arg)
437446
forargind.get('required', [])]
438-
[sub_parser_action.add_argument("--%s"%arg,required=False)
447+
[_add_arg(sub_parser_action,False,arg)
439448
forargind.get('optional', [])]
440449

441450

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp