1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-02-20 11:58:55 +00:00

commands/show: handle aliases

Replace the ad-hoc get_plugin() function in the show command (which was
broken for aliases) with a call to pluginloader.get_plugin_class(),
which correctly handles alias resolution.
This commit is contained in:
Sergei Trofimov 2018-05-23 14:41:39 +01:00 committed by Marc Bonnici
parent 712e64458c
commit 76f436d770

View File

@ -46,7 +46,10 @@ class ShowCommand(Command):
plugin_name = name.lower()
kind = 'global:'
else:
plugin = get_plugin(name)
try:
plugin = pluginloader.get_plugin_class(name)
except NotFoundError:
plugin = None
if plugin:
rst_output = get_rst_from_plugin(plugin)
plugin_name = plugin.name
@ -78,16 +81,6 @@ class ShowCommand(Command):
print rst_output
def get_plugin(name):
for plugin in pluginloader.list_plugins():
if name == identifier(plugin.name):
return plugin
if hasattr(plugin, 'alias'):
for alias in plugin.alias:
if name == alias:
return plugin
def get_target_description(name):
targets = list_target_descriptions()
for target in targets: