Skip to content

Commit b144276

Browse files
Allow building selected packages with --package
Issue #22
1 parent ec52f53 commit b144276

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/main.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ enum OuterCommand {
8282
#[clap(version, about)]
8383
struct Args {
8484
/// Directory containing crate to analyze. Defaults to current working directory.
85-
#[clap(short, long)]
85+
#[clap(long)]
8686
path: Option<PathBuf>,
8787

8888
/// Path to cackle.toml. Defaults to cackle.toml in the directory containing Cargo.toml.
@@ -163,6 +163,12 @@ struct Args {
163163
#[clap(long)]
164164
no_backtrace: bool,
165165

166+
// We may at some point allow this to be a short flag, but should probably wait a few releases.
167+
// -p was previously accepted for --path.
168+
/// Packages to build and analyse.
169+
#[clap(long)]
170+
package: Vec<String>,
171+
166172
#[command(subcommand)]
167173
command: Option<Command>,
168174
}

src/proxy.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ impl<'a> CargoRunner<'a> {
121121
self.args,
122122
&self.config.raw.common,
123123
);
124+
for pkg in &self.args.package {
125+
command.arg("-p").arg(pkg);
126+
}
124127
if self.args.command.is_none() {
125128
let default_build_flags = ["--all-targets".to_owned()];
126129
for flag in self

0 commit comments

Comments
 (0)