warg_cli/commands/
lock.rs

1use super::CommonOptions;
2use anyhow::Result;
3use clap::Args;
4use warg_protocol::registry::PackageName;
5
6/// Print Dependency Tree
7#[derive(Args)]
8pub struct LockCommand {
9    /// The common command options.
10    #[clap(flatten)]
11    pub common: CommonOptions,
12
13    /// Only show information for the specified package.
14    #[clap(value_name = "PACKAGE")]
15    pub package: PackageName,
16}
17
18impl LockCommand {
19    /// Executes the command.
20    pub async fn exec(self) -> Result<()> {
21        let config = self.common.read_config()?;
22        let client = self.common.create_client(&config).await?;
23
24        let info = client.package(&self.package).await?;
25        client.lock_component(&info).await?;
26
27        Ok(())
28    }
29}