cargo-detect-package

Crates.iocargo-detect-package
lib.rscargo-detect-package
version0.1.8
created_at2025-07-15 18:38:32.042527+00
updated_at2025-08-19 18:46:32.621538+00
descriptionA Cargo tool to detect the package that a file belongs to, passing the package name to a subcommand
homepage
repositoryhttps://github.com/folo-rs/folo
max_upload_size
id1753693
size67,844
Sander Saares (sandersaares)

documentation

README

A Cargo tool to detect the package that a file belongs to, passing the package name to a subcommand.

This tool automatically detects which Cargo package a given file belongs to within a workspace, and then executes a subcommand with the appropriate package scope. It supports both cargo integration mode and environment variable mode for build tool integration.

Usage

# Build the package containing src/lib.rs
cargo detect-package --path packages/events/src/lib.rs build
# Executes: cargo build -p events

# Test the package containing a specific test file  
cargo detect-package --path packages/many_cpus/tests/integration.rs test
# Executes: cargo test -p many_cpus

# Use with environment variable mode for non-cargo tools
cargo detect-package --path packages/events/src/lib.rs --via-env PACKAGE just test
# Executes: PACKAGE=events just test

The tool automatically adds -p <package_name> for specific packages or --workspace when no specific package is detected.

More details in the package documentation.

This is part of the Folo project that provides mechanisms for high-performance hardware-aware programming in Rust.

Commit count: 810

cargo fmt