Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sort cogs alphabetically inside [p]cog list #6215

Merged
merged 3 commits into from Sep 13, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions redbot/cogs/downloader/downloader.py
Expand Up @@ -7,6 +7,7 @@
from pathlib import Path
from typing import Tuple, Union, Iterable, Collection, Optional, Dict, Set, List, cast
from collections import defaultdict
from operator import attrgetter

import discord
from redbot.core import commands, Config, version_info as red_version_info
Expand Down Expand Up @@ -1329,7 +1330,7 @@ async def _cog_list(self, ctx: commands.Context, repo: Repo) -> None:
installed_cogs_in_repo = [cog for cog in all_installed_cogs if cog.repo_name == repo.name]
installed_str = "\n".join(
"- {}{}".format(i.name, ": {}".format(i.short) if i.short else "")
for i in installed_cogs_in_repo
for i in sorted(installed_cogs_in_repo, key=attrgetter("name"))
)

if len(installed_cogs_in_repo) > 1:
Expand All @@ -1342,7 +1343,7 @@ async def _cog_list(self, ctx: commands.Context, repo: Repo) -> None:
]
available_str = "\n".join(
"+ {}{}".format(cog.name, ": {}".format(cog.short) if cog.short else "")
for cog in available_cogs
for cog in sorted(available_cogs, key=attrgetter("name"))
)

if not available_str:
Expand Down