mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-02-21 20:38:57 +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:
parent
712e64458c
commit
76f436d770
@ -46,7 +46,10 @@ class ShowCommand(Command):
|
|||||||
plugin_name = name.lower()
|
plugin_name = name.lower()
|
||||||
kind = 'global:'
|
kind = 'global:'
|
||||||
else:
|
else:
|
||||||
plugin = get_plugin(name)
|
try:
|
||||||
|
plugin = pluginloader.get_plugin_class(name)
|
||||||
|
except NotFoundError:
|
||||||
|
plugin = None
|
||||||
if plugin:
|
if plugin:
|
||||||
rst_output = get_rst_from_plugin(plugin)
|
rst_output = get_rst_from_plugin(plugin)
|
||||||
plugin_name = plugin.name
|
plugin_name = plugin.name
|
||||||
@ -78,16 +81,6 @@ class ShowCommand(Command):
|
|||||||
print rst_output
|
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):
|
def get_target_description(name):
|
||||||
targets = list_target_descriptions()
|
targets = list_target_descriptions()
|
||||||
for target in targets:
|
for target in targets:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user