mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 03:08:55 -05:00
[Downloader] Allow removal of multiple repos (#5082)
* add multi repo support + docstring * update docs * Update redbot/cogs/downloader/downloader.py Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com> * style * Update redbot/cogs/downloader/downloader.py Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
This commit is contained in:
parent
23997d7a71
commit
210c07d5a7
@ -461,14 +461,15 @@ repo delete
|
|||||||
|
|
||||||
**Description**
|
**Description**
|
||||||
|
|
||||||
Remove a repo and its files.
|
Remove repos and their files.
|
||||||
|
|
||||||
Example:
|
Examples:
|
||||||
- ``[p]repo delete 26-Cogs``
|
- ``[p]repo delete 26-Cogs``
|
||||||
|
- ``[p]repo delete 26-Cogs Laggrons-Dumb-Cogs``
|
||||||
|
|
||||||
**Arguments**
|
**Arguments**
|
||||||
|
|
||||||
- ``<repo>`` The name of an already added repo
|
- ``<repos...>`` The repo or repos to remove.
|
||||||
|
|
||||||
.. _downloader-command-repo-info:
|
.. _downloader-command-repo-info:
|
||||||
|
|
||||||
|
|||||||
@ -583,22 +583,29 @@ class Downloader(commands.Cog):
|
|||||||
if repo.install_msg:
|
if repo.install_msg:
|
||||||
await ctx.send(repo.install_msg.replace("[p]", ctx.clean_prefix))
|
await ctx.send(repo.install_msg.replace("[p]", ctx.clean_prefix))
|
||||||
|
|
||||||
@repo.command(name="delete", aliases=["remove", "del"])
|
@repo.command(name="delete", aliases=["remove", "del"], require_var_positional=True)
|
||||||
async def _repo_del(self, ctx: commands.Context, repo: Repo) -> None:
|
async def _repo_del(self, ctx: commands.Context, *repos: Repo) -> None:
|
||||||
"""
|
"""
|
||||||
Remove a repo and its files.
|
Remove repos and their files.
|
||||||
|
|
||||||
Example:
|
Examples:
|
||||||
- `[p]repo delete 26-Cogs`
|
- `[p]repo delete 26-Cogs`
|
||||||
|
- `[p]repo delete 26-Cogs Laggrons-Dumb-Cogs`
|
||||||
|
|
||||||
**Arguments**
|
**Arguments**
|
||||||
|
|
||||||
- `<repo>` The name of an already added repo
|
- `<repos...>` The repo or repos to remove.
|
||||||
"""
|
"""
|
||||||
await self._repo_manager.delete_repo(repo.name)
|
for repo in set(repos):
|
||||||
|
await self._repo_manager.delete_repo(repo.name)
|
||||||
|
|
||||||
await ctx.send(
|
await ctx.send(
|
||||||
_("The repo `{repo.name}` has been deleted successfully.").format(repo=repo)
|
(
|
||||||
|
_("Successfully deleted repos: ")
|
||||||
|
if len(repos) > 1
|
||||||
|
else _("Successfully deleted the repo: ")
|
||||||
|
)
|
||||||
|
+ humanize_list([inline(i.name) for i in set(repos)])
|
||||||
)
|
)
|
||||||
|
|
||||||
@repo.command(name="list")
|
@repo.command(name="list")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user