1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-01-31 02:01:16 +00:00

utils/doc: include plugin aliases in the docs

If a plugin defines aliases, include the aliases and the parameter
values they correspond to inside the docs.
This commit is contained in:
Sergei Trofimov 2018-05-23 14:31:15 +01:00 committed by Marc Bonnici
parent 063212c2a9
commit 2a2eafa282

View File

@ -294,6 +294,15 @@ def get_params_rst(parameters):
return text
def get_aliases_rst(aliases):
text = ''
for alias in aliases:
param_str = ', '.join(['{}={}'.format(n, format_literal(v))
for n, v in alias.params.iteritems()])
text += '{}\n{}\n'.format(alias.name, indent(param_str))
return text
def underline(text, symbol='='):
return '{}\n{}\n\n'.format(text, symbol * len(text))
@ -312,7 +321,13 @@ def get_rst_from_plugin(plugin):
else:
desc = ''
text += desc + '\n\n'
aliases_rst = get_aliases_rst(plugin.aliases)
if aliases_rst:
text += underline('aliases', '~') + aliases_rst
params_rst = get_params_rst(plugin.parameters)
if params_rst:
text += underline('parameters', '~') + params_rst
return text + '\n'