Crates.io | cargo-detect-package |
lib.rs | cargo-detect-package |
version | 0.1.8 |
created_at | 2025-07-15 18:38:32.042527+00 |
updated_at | 2025-08-19 18:46:32.621538+00 |
description | A Cargo tool to detect the package that a file belongs to, passing the package name to a subcommand |
homepage | |
repository | https://github.com/folo-rs/folo |
max_upload_size | |
id | 1753693 |
size | 67,844 |
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.
# 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.