Skip to main content

asimov_cli/commands/module/
link.rs

1// This is free and unencumbered software released into the public domain.
2
3use crate::{BoxError, StandardOptions, SysexitsError::*};
4use asimov_module::ModuleName;
5
6pub async fn link(module_name: ModuleName, _flags: &StandardOptions) -> Result<(), BoxError> {
7    let registry = asimov_registry::Registry::default();
8
9    let manifest = registry
10        .read_manifest(&module_name)
11        .await
12        .map_err(|e| {
13            tracing::error!("failed to read module manifest: {e}");
14            EX_UNAVAILABLE
15        })?
16        .manifest;
17
18    let mut links = manifest.links;
19    crate::sort_links(&manifest.name, &mut links);
20
21    for link in links {
22        println!("{link}");
23    }
24
25    Ok(())
26}