Uninstall a plugin
(name: str)
| 190 | @plug.command() |
| 191 | @click.argument("name") |
| 192 | def 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() |
nothing calls this directly
no test coverage detected