summaryrefslogtreecommitdiff
path: root/src/cargo/internal.rs
blob: b3e44e4b2cfbdf10b26992a49a65e19f1d0ed402 (plain) (blame)
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
use std::path::Path;

use cargo::{
    core::Workspace,
    ops::{clean, CleanOptions},
    util::{context::GlobalContext, interning::InternedString},
    CargoResult,
};

use crate::cli::Args;

pub fn clean_int(path: &Path, cli: &Args) -> CargoResult<()> {
    let gctx = GlobalContext::default()?;

    let workspace = Workspace::new(path, &gctx)?;

    let opts = CleanOptions {
        gctx: &gctx,
        spec: vec![],
        targets: vec![],
        profile_specified: false,
        requested_profile: InternedString::new("dev"),
        doc: cli.doc,
        dry_run: cli.dry_run,
    };

    clean(&workspace, &opts)
}