asimov_cli/commands/module/
disable.rs1use crate::{StandardOptions, SysexitsError::*};
4use color_print::cprintln;
5use core::error::Error;
6
7pub async fn disable(
8 module_names: &Vec<String>,
9 flags: &StandardOptions,
10) -> Result<(), Box<dyn Error>> {
11 let registry = asimov_registry::Registry::default();
12 for module_name in module_names {
13 if flags.verbose > 1 {
14 cprintln!("<s,c>»</> Disabling module <s>{module_name}</>...");
15 }
16
17 registry.disable_module(&module_name).await.map_err(|e| {
18 tracing::error!("failed to disable module `{module_name}`: {e}");
19 EX_UNAVAILABLE
20 })?;
21
22 if flags.verbose > 0 {
23 cprintln!("<s,g>✓</> Disabled module <s>{module_name}</>.");
24 }
25 }
26 Ok(())
27}