XD-DENG commented on a change in pull request #13036:
URL: https://github.com/apache/airflow/pull/13036#discussion_r541787038
##########
File path: airflow/cli/commands/plugins_command.py
##########
@@ -78,33 +75,17 @@ def dump_plugins(args):
print("No plugins loaded")
return
- console = Console()
- console.print("[bold yellow]SUMMARY:[/bold yellow]")
- console.print(
- f"[bold green]Plugins directory[/bold green]: {conf.get('core',
'plugins_folder')}\n", highlight=False
- )
- console.print(
- f"[bold green]Loaded plugins[/bold green]:
{len(plugins_manager.plugins)}\n", highlight=False
- )
+ plugins_info: List[Dict[str, str]] = []
+ for plugin in plugins_manager.plugins:
+ info = {"name": plugin.name}
+ info.update({n: getattr(plugin, n) for n in
PLUGINS_ATTRIBUTES_TO_DUMP})
+ plugins_info.append(info)
- for attr_name in PLUGINS_MANAGER_ATTRIBUTES_TO_DUMP:
- attr_value: Optional[List[Any]] = getattr(plugins_manager, attr_name)
- if not attr_value:
- continue
- table = SimpleTable(title=attr_name.capitalize().replace("_", " "))
- table.add_column(width=100)
- for item in attr_value: # pylint: disable=not-an-iterable
- table.add_row(
- f"- {_get_name(item)}",
- )
- console.print(table)
+ # Remove empty info
+ if args.output == "table": # pylint: disable=too-many-nested-blocks
+ for col in list(plugins_info[0].keys()): # it will exist as there's
at least one plugin
Review comment:
And I'm not sure if the comment is correct. I assume it's possible to
have zero plugin?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]