MCPcopy Index your code
hub / github.com/AstrBotDevs/AstrBot / remove

Function remove

astrbot/cli/commands/cmd_plug.py:192–211  ·  view source on GitHub ↗

Uninstall a plugin

(name: str)

Source from the content-addressed store, hash-verified

190@plug.command()
191@click.argument("name")
192def remove(name: str) -> None:
193 """Uninstall a plugin"""
194 base_path = _get_data_path()
195 plugins = build_plug_list(base_path / "plugins")
196 plugin = next((p for p in plugins if p["name"] == name), None)
197
198 if not plugin or not plugin.get("local_path"):
199 raise click.ClickException(f"Plugin {name} does not exist or is not installed")
200
201 plugin_path = plugin["local_path"]
202
203 click.confirm(
204 f"Are you sure you want to uninstall plugin {name}?", default=False, abort=True
205 )
206
207 try:
208 shutil.rmtree(plugin_path)
209 click.echo(f"Plugin {name} has been uninstalled")
210 except Exception as e:
211 raise click.ClickException(f"Failed to uninstall plugin {name}: {e}")
212
213
214@plug.command()

Callers

nothing calls this directly

Calls 3

_get_data_pathFunction · 0.85
build_plug_listFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected