Skip to content

Commit

Permalink
Improve list hardware components output and code for better readabili…
Browse files Browse the repository at this point in the history
  • Loading branch information
destogl authored and flochre committed Jul 5, 2023
1 parent f9b2ba7 commit 24eae44
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,18 @@ def main(self, *, args):
hardware_components = list_hardware_components(node, args.controller_manager)

for idx, component in enumerate(hardware_components.component):
print(f'Hardware Component {idx}\n\tname: {component.name}\n\ttype: {component.type}')
print(f'Hardware Component {idx+1}\n\tname: {component.name}\n\ttype: {component.type}')
if hasattr(component, 'plugin_name'):
plugin_name = component.plugin_name
# Keep compatibility to the obsolete filed name in Humble
elif hasattr(component, 'class_type'):
plugin_name = component.class_type
else:
plugin_name = f'{bcolors.WARNING}plugin name missing!{bcolors.ENDC}'

print(f'\tplugin name: {plugin_name}\n\tstate: id={component.state.id} label={component.state.label}\n\tcommand interfaces')
print(f'\tplugin name: {plugin_name}\n'
f'\tstate: id={component.state.id} label={component.state.label}\n'
f'\tcommand interfaces')
for cmd_interface in component.command_interfaces:

if cmd_interface.is_available:
Expand Down

0 comments on commit 24eae44

Please sign in to comment.