mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
Code simplification/explicitation
This commit is contained in:
parent
50b19a95c6
commit
80873777c6
1 changed files with 4 additions and 6 deletions
|
@ -288,14 +288,12 @@ class ActionsMapParser(BaseActionsMapParser):
|
|||
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self, parent=None, parser=None, subparser_kwargs=None, top_parser=None, **kwargs
|
||||
):
|
||||
def __init__(self, parent=None, parser=None, subparser_kwargs=None, top_parser=None):
|
||||
|
||||
super(ActionsMapParser, self).__init__(parent)
|
||||
|
||||
if subparser_kwargs is None:
|
||||
subparser_kwargs = {"title": "categories", "required": False}
|
||||
|
||||
self._parser = parser or ExtendedArgumentParser()
|
||||
self._subparsers = self._parser.add_subparsers(**subparser_kwargs)
|
||||
self.global_parser = parent.global_parser if parent else None
|
||||
|
@ -336,7 +334,7 @@ class ActionsMapParser(BaseActionsMapParser):
|
|||
parser = self._subparsers.add_parser(
|
||||
name, description=category_help, help=category_help, **kwargs
|
||||
)
|
||||
return self.__class__(self, parser, {"title": "subcommands", "required": True})
|
||||
return self.__class__(parent=self, parser=parser, subparser_kwargs={"title": "subcommands", "required": True})
|
||||
|
||||
def add_subcategory_parser(self, name, subcategory_help=None, **kwargs):
|
||||
"""Add a parser for a subcategory
|
||||
|
@ -355,7 +353,7 @@ class ActionsMapParser(BaseActionsMapParser):
|
|||
help=subcategory_help,
|
||||
**kwargs,
|
||||
)
|
||||
return self.__class__(self, parser, {"title": "actions", "required": True})
|
||||
return self.__class__(parent=self, parser=parser, subparser_kwargs={"title": "actions", "required": True})
|
||||
|
||||
def add_action_parser(
|
||||
self,
|
||||
|
|
Loading…
Reference in a new issue