Skip to content

Commit 9a16bdd

Browse files
committed
fix(cli): allow exclusive arguments as optional
The CLI takes its arguments from the RequiredOptional, which has three fields: required, optional, and exclusive. In practice, the exclusive options are not defined as either required or optional, and would not be allowed in the CLI. This changes that, so that exclusive options are also added to the argument parser. Closes #2769
1 parent 72e1aa7 commit 9a16bdd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

gitlab/v4/cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ def _populate_sub_parser_by_class(
258258
sub_parser_action.add_argument(
259259
f"--{x.replace('_', '-')}", required=True
260260
)
261-
for x in mgr_cls._create_attrs.optional:
261+
for x in mgr_cls._create_attrs.optional + mgr_cls._create_attrs.exclusive:
262262
sub_parser_action.add_argument(
263263
f"--{x.replace('_', '-')}", required=False
264264
)
@@ -274,7 +274,7 @@ def _populate_sub_parser_by_class(
274274
f"--{x.replace('_', '-')}", required=True
275275
)
276276

277-
for x in mgr_cls._update_attrs.optional:
277+
for x in mgr_cls._update_attrs.optional + mgr_cls._update_attrs.exclusive:
278278
if x != cls._id_attr:
279279
sub_parser_action.add_argument(
280280
f"--{x.replace('_', '-')}", required=False

0 commit comments

Comments
 (0)