From 137346307248bc9e327847e549c3d6c24b3b11f3 Mon Sep 17 00:00:00 2001 From: fxqnlr Date: Sat, 17 Aug 2024 00:14:10 +0200 Subject: add external cargo --- src/cargo/internal.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/cargo/internal.rs (limited to 'src/cargo/internal.rs') diff --git a/src/cargo/internal.rs b/src/cargo/internal.rs new file mode 100644 index 0000000..b3e44e4 --- /dev/null +++ b/src/cargo/internal.rs @@ -0,0 +1,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) +} -- cgit v1.2.3