Skip to content

Commit e2c15d4

Browse files
committed
修补 /plugin list 命令
1 parent 120405f commit e2c15d4

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

aipyapp/cli/command/builtin/cmd_plugin.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,20 @@ def get_arg_values(self, name, subcommand=None, partial=None):
2525
return None
2626

2727
def cmd_list(self, args, ctx):
28-
"""列出可用的插件"""
29-
rows = []
28+
"""列出插件"""
3029
if ctx.task:
31-
plugins = ctx.task.plugins
30+
plugins = ctx.task.plugins.values()
3231
title = T('Enabled Plugins')
3332
else:
34-
plugins = None
33+
plugins = ctx.tm.plugin_manager.get_task_plugins()
3534
title = T('Available Plugins')
36-
for plugin in ctx.tm.plugin_manager:
37-
if plugins and plugin.name not in plugins:
38-
continue
35+
36+
rows = []
37+
for plugin in plugins:
3938
rows.append([plugin.name, plugin.description, plugin.get_type().name, plugin.version, plugin.author])
40-
table = row2table(rows, headers=[T('Name'), T('Description'), T('Type'), T('Version'), T('Author')], title=title)
41-
ctx.console.print(table)
39+
if rows:
40+
table = row2table(rows, headers=[T('Name'), T('Description'), T('Type'), T('Version'), T('Author')], title=title)
41+
ctx.console.print(table)
4242

4343
def _get_first_line(self, doc: str) -> str:
4444
"""Get the first non-empty line of the docstring"""

0 commit comments

Comments
 (0)