Skip to content

Commit

Permalink
added 'no plugin found' message for list command
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan-1F committed Jun 30, 2024
1 parent 3b8e1bf commit 5e5d69d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lang/en_us.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,5 @@ mcdreforged_plugin_manager:
all_up_to_date: §aAll plugins are up to date
click_to_upgrade: Upgrade to {0}

search:
empty: No plugin was found
list:
empty: §cNo plugin was found
2 changes: 1 addition & 1 deletion lang/zh_cn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,5 @@ mcdreforged_plugin_manager:
all_up_to_date: §a所有插件均为最新版
click_to_upgrade: 更新至 {0}

search:
list:
empty: §c未找到满足条件的插件
7 changes: 5 additions & 2 deletions mcdreforged_plugin_manager/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,12 @@ def show_help_message(source: CommandSource):

@ensure_cache_loaded
def list_plugins(source: CommandSource, labels: Optional[Union[None, str, List[str]]] = None):
for plugin in cache.get_plugins_by_labels(labels):
plugins = list(cache.get_plugins_by_labels(labels))
for plugin in plugins:
source.reply(plugin.meta.brief)
source.reply('')
if len(plugins) == 0:
source.reply(tr('list.empty'))


@ensure_cache_loaded
Expand All @@ -76,7 +79,7 @@ def search(source: CommandSource, query: str):
source.reply(plugin.meta.brief)
source.reply('')
if len(plugins) == 0:
source.reply(tr('search.empty'))
source.reply(tr('list.empty'))


@ensure_cache_loaded
Expand Down

0 comments on commit 5e5d69d

Please sign in to comment.