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

[Downloader] Add link mode to repo list #6181

Open
wants to merge 6 commits into
base: V3/develop
Choose a base branch
from
Open
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions redbot/cogs/downloader/downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -617,12 +617,24 @@ async def _repo_del(self, ctx: commands.Context, *repos: Repo) -> None:
)

@repo.command(name="list")
async def _repo_list(self, ctx: commands.Context) -> None:
"""List all installed repos."""
async def _repo_list(self, ctx: commands.Context, links: Optional[bool] = False) -> None:
Dav-Git marked this conversation as resolved.
Show resolved Hide resolved
"""
List all installed repos.

`links`: Shows links instead of descriptions when set to `True`.
Default to False.
"""
repos = self._repo_manager.repos
sorted_repos = sorted(repos, key=lambda r: str.lower(r.name))
if len(repos) == 0:
joined = _("There are no repos installed.")
await ctx.send(box(_("There are no repos installed."), lang="markdown"))
return
if links:
joined = _("Installed Repos:\n")
for repo in sorted_repos:
joined += "+ {}: <{}>\n".format(repo.name, repo.clean_url)
for page in pagify(joined, ["\n"], shorten_by=16):
await ctx.send(page.lstrip(" "))
else:
if len(repos) > 1:
joined = _("# Installed Repos\n")
Expand All @@ -631,8 +643,8 @@ async def _repo_list(self, ctx: commands.Context) -> None:
for repo in sorted_repos:
joined += "+ {}: {}\n".format(repo.name, repo.short or "")

for page in pagify(joined, ["\n"], shorten_by=16):
await ctx.send(box(page.lstrip(" "), lang="markdown"))
for page in pagify(joined, ["\n"], shorten_by=16):
await ctx.send(box(page.lstrip(" "), lang="markdown"))

@repo.command(name="info")
async def _repo_info(self, ctx: commands.Context, repo: Repo) -> None:
Expand Down