asimov_module_cli/commands/
enable.rs1use crate::{
4 StandardOptions,
5 SysexitsError::{self, *},
6};
7use color_print::cprintln;
8
9#[tokio::main]
10pub async fn enable(
11 module_names: Vec<String>,
12 flags: &StandardOptions,
13) -> Result<(), SysexitsError> {
14 let installer = asimov_installer::Installer::default();
15 for module_name in module_names {
16 if flags.verbose > 1 {
17 cprintln!("<s,c>»</> Enabling module `{module_name}`...");
18 }
19
20 installer.enable_module(&module_name).await.map_err(|e| {
21 tracing::error!("failed to enable module `{module_name}`: {e}");
22 EX_UNAVAILABLE
23 })?;
24
25 if flags.verbose > 0 {
26 cprintln!("<s,g>✓</> Enabled module `{module_name}`.");
27 }
28 }
29 Ok(())
30}