|
58 | 58 | gitlab.ProjectMilestone: {'issues': {'required': ['id', 'project-id']}}, |
59 | 59 | gitlab.Project: {'search': {'required': ['query']}, |
60 | 60 | 'owned': {}, |
61 | | - 'all': {}, |
| 61 | + 'all': {'optional': [('all', bool)]}, |
62 | 62 | 'starred': {}, |
63 | 63 | 'star': {'required': ['id']}, |
64 | 64 | 'unstar': {'required': ['id']}, |
@@ -181,7 +181,7 @@ def do_project_search(self, cls, gl, what, args): |
181 | 181 |
|
182 | 182 | def do_project_all(self, cls, gl, what, args): |
183 | 183 | try: |
184 | | - return gl.projects.all() |
| 184 | + return gl.projects.all(all=args['all']) |
185 | 185 | except Exception as e: |
186 | 186 | _die("Impossible to list all projects", e) |
187 | 187 |
|
@@ -430,12 +430,21 @@ def _populate_sub_parser_by_class(cls, sub_parser): |
430 | 430 | for x in attrs] |
431 | 431 |
|
432 | 432 | if cls in EXTRA_ACTIONS: |
| 433 | + def _add_arg(parser, required, data): |
| 434 | + extra_args = {} |
| 435 | + if isinstance(data, tuple): |
| 436 | + if data[1] is bool: |
| 437 | + extra_args = {'action': 'store_true'} |
| 438 | + data = data[0] |
| 439 | + |
| 440 | + parser.add_argument("--%s" % data, required=required, **extra_args) |
| 441 | + |
433 | 442 | for action_name in sorted(EXTRA_ACTIONS[cls]): |
434 | 443 | sub_parser_action = sub_parser.add_parser(action_name) |
435 | 444 | d = EXTRA_ACTIONS[cls][action_name] |
436 | | - [sub_parser_action.add_argument("--%s" % arg, required=True) |
| 445 | + [_add_arg(sub_parser_action, True, arg) |
437 | 446 | for arg in d.get('required', [])] |
438 | | - [sub_parser_action.add_argument("--%s" % arg, required=False) |
| 447 | + [_add_arg(sub_parser_action, False, arg) |
439 | 448 | for arg in d.get('optional', [])] |
440 | 449 |
|
441 | 450 |
|
|
0 commit comments