aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/mozart/src/commands/prohibits.rs
blob: 0a77e8b107321546e523f4a0b36e23ea595679d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
use clap::Args;
use mozart_core::console::IoInterface;

#[derive(Args)]
pub struct ProhibitsArgs {
    /// Package to inspect
    pub package: String,

    /// Version constraint
    pub version: String,

    /// Recursively resolve up to the root package
    #[arg(short, long)]
    pub recursive: bool,

    /// Prints the results as a nested tree
    #[arg(short, long)]
    pub tree: bool,

    /// Read dependency information from the lock file
    #[arg(long)]
    pub locked: bool,
}

pub async fn execute(
    args: &ProhibitsArgs,
    cli: &super::Cli,
    io: std::sync::Arc<std::sync::Mutex<Box<dyn IoInterface>>>,
) -> anyhow::Result<()> {
    super::dependency::do_execute(
        cli,
        io,
        super::dependency::DoExecuteArgs {
            package: &args.package,
            version: Some(&args.version),
            recursive: args.recursive,
            tree: args.tree,
            locked: args.locked,
            inverted: true,
        },
    )
}