get dependencies in API

This commit is contained in:
Emmanuel Garette 2020-08-04 16:35:40 +02:00
parent 5c1d4afd56
commit 96c76286db

View File

@ -52,7 +52,7 @@ class TiramisuHelp:
if module_name in ['forcepermissive', 'unrestraint']:
force = True
max_len = max(max_len, len('forcepermissive'))
elif module_name is not 'help' and not module_name.startswith('_'):
elif module_name != 'help' and not module_name.startswith('_'):
modules.append(module_name)
max_len = max(max_len, len(module_name))
modules.sort()
@ -212,6 +212,17 @@ class _TiramisuOptionOptionDescription(CommonTiramisuOption):
"""Test if option has dependency"""
return self._option_bag.option.impl_has_dependency(self_is_dep)
@option_and_connection
async def dependencies(self):
"""Get dependencies from this option"""
options = []
for option in self._option_bag.option._get_dependencies(self._option_bag.config_bag.context):
options.append(TiramisuOption(option().impl_getpath(),
None,
self._option_bag.config_bag,
))
return options
@option_and_connection
async def isoptiondescription(self):
"""Test if option is an optiondescription"""