Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions gitlab/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ class RESTObject(object):
without ID in the url.
"""

# If _arg_name is set, used by the CLI to determine the argument name
_arg_name: Optional[str] = None
_id_attr: Optional[str] = "id"
_attrs: Dict[str, Any]
_module: ModuleType
Expand Down
5 changes: 4 additions & 1 deletion gitlab/v4/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,10 @@ def extend_parser(parser):
classes.sort(key=operator.attrgetter("__name__"))

for cls in classes:
arg_name = cli.cls_to_what(cls)
if cls._arg_name is not None:
arg_name = cls._arg_name
else:
arg_name = cli.cls_to_what(cls)
object_group = subparsers.add_parser(arg_name)

object_subparsers = object_group.add_subparsers(
Expand Down
1 change: 1 addition & 0 deletions gitlab/v4/objects/ldap.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@


class LDAPGroup(RESTObject):
_arg_name = "ldap-group"
_id_attr = None


Expand Down
2 changes: 2 additions & 0 deletions gitlab/v4/objects/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class CurrentUserEmailManager(RetrieveMixin, CreateMixin, DeleteMixin, RESTManag


class CurrentUserGPGKey(ObjectDeleteMixin, RESTObject):
_arg_name = "current-user-gpg-key"
pass


Expand Down Expand Up @@ -364,6 +365,7 @@ class UserActivitiesManager(ListMixin, RESTManager):


class UserGPGKey(ObjectDeleteMixin, RESTObject):
_arg_name = "user-gpg-key"
pass


Expand Down