mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
[mod] renaming, make method name match reality and had a method for code readability
This commit is contained in:
parent
79bb5b427f
commit
1caa172072
4 changed files with 13 additions and 6 deletions
|
@ -603,9 +603,10 @@ class ActionsMap(object):
|
|||
# Set the global configuration to use for the parser.
|
||||
top_parser.set_global_conf(_global['configuration'])
|
||||
|
||||
# GLOBAL_SECTION = '_global'
|
||||
_add_arguments(GLOBAL_SECTION, top_parser.add_global_parser(),
|
||||
_global['arguments'])
|
||||
if top_parser.has_global_parser():
|
||||
# GLOBAL_SECTION = '_global'
|
||||
_add_arguments(GLOBAL_SECTION, top_parser.get_global_parser(),
|
||||
_global['arguments'])
|
||||
|
||||
# category_name is stuff like "user", "domain", "hooks"...
|
||||
# category_values is the values of this category (like actions)
|
||||
|
|
|
@ -72,6 +72,9 @@ class BaseActionsMapParser(object):
|
|||
raise NotImplementedError("derived class '%s' must override this method" %
|
||||
self.__class__.__name__)
|
||||
|
||||
def has_global_parser(self):
|
||||
return False
|
||||
|
||||
def add_global_parser(self, **kwargs):
|
||||
"""Add a parser for global arguments
|
||||
|
||||
|
|
|
@ -548,7 +548,7 @@ class ActionsMapParser(BaseActionsMapParser):
|
|||
return [name.replace('--', '@', 1)]
|
||||
return [name.replace('-', '@', 1)]
|
||||
|
||||
def add_global_parser(self, **kwargs):
|
||||
def get_global_parser(self, **kwargs):
|
||||
raise AttributeError("global arguments are not managed")
|
||||
|
||||
def add_category_parser(self, name, **kwargs):
|
||||
|
|
|
@ -235,7 +235,7 @@ class ActionsMapParser(BaseActionsMapParser):
|
|||
|
||||
if top_parser:
|
||||
# Append each top parser action to the global group
|
||||
glob = self.add_global_parser()
|
||||
glob = self.get_global_parser()
|
||||
for action in top_parser._actions:
|
||||
action.dest = SUPPRESS
|
||||
glob._add_action(action)
|
||||
|
@ -252,7 +252,10 @@ class ActionsMapParser(BaseActionsMapParser):
|
|||
return [name, full]
|
||||
return [name]
|
||||
|
||||
def add_global_parser(self, **kwargs):
|
||||
def has_global_parser(self):
|
||||
return True
|
||||
|
||||
def get_global_parser(self, **kwargs):
|
||||
if not self._global_parser:
|
||||
self._global_parser = self._parser.add_argument_group(
|
||||
"global arguments")
|
||||
|
|
Loading…
Reference in a new issue