Linux command
cargo-locate-project 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Show manifest path
cargo locate-project
Show workspace root manifest
cargo locate-project --workspace
Output as plain path
cargo locate-project --message-format plain
Output as JSON
cargo locate-project --message-format json
Locate project from a specific directory
cargo locate-project --manifest-path [path/to/Cargo.toml]
说明
cargo locate-project prints the path to the Cargo.toml manifest file for the current package. Searches current directory and parent directories for the manifest.
参数
- --workspace
- Locate workspace root Cargo.toml instead of current package
- --message-format _format_
- Output format: json (default), plain
- --manifest-path _path_
- Path to Cargo.toml
- -v, --verbose
- Verbose output
- -q, --quiet
- Suppress log messages
- --color _WHEN_
- Control color output: auto, always, never
FAQ
What is the cargo-locate-project command used for?
cargo locate-project prints the path to the Cargo.toml manifest file for the current package. Searches current directory and parent directories for the manifest.
How do I run a basic cargo-locate-project example?
Run `cargo locate-project` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --workspace do in cargo-locate-project?
Locate workspace root Cargo.toml instead of current package