mod normal;
mod output;
mod symlink;
mod system;
mod unset;
use rust_i18n::t;
use crate::error::{Result, ScoopError};
use crate::output::Output;
pub fn execute(
output: &Output,
name: Option<&str>,
unset: bool,
global: bool,
link: bool,
) -> Result<()> {
let cwd = std::env::current_dir()?;
if unset {
return unset::handle(output, &cwd, global);
}
let name = name.ok_or_else(|| ScoopError::InvalidArgument {
message: t!("error.use_missing_name").to_string(),
})?;
if name.eq_ignore_ascii_case("system") {
return system::handle(output, &cwd, global);
}
normal::handle(output, &cwd, name, global, link)
}