zoi_cli/cmd/extension.rs
1//! Command for managing Zoi extensions (plugins).
2
3use anyhow::Result;
4
5use crate::cli::{ExtensionCommand, ExtensionCommands};
6use crate::pkg;
7
8/// Runs the 'extension' command.
9///
10/// Dispatches to subcommands for adding or removing extensions.
11///
12/// # Errors
13///
14/// Returns an error if the extension addition or removal fails.
15pub fn run(
16 args: ExtensionCommand,
17 yes: bool,
18 plugin_manager: Option<&crate::pkg::plugin::PluginManager>
19) -> Result<()> {
20 match args.command {
21 ExtensionCommands::Add { name } => {
22 pkg::extension::add(&name, yes, plugin_manager)
23 }
24 ExtensionCommands::Remove { name } => {
25 pkg::extension::remove(&name, yes, plugin_manager)
26 }
27 }
28}