Skip to content

Command-line-friendly version of locate-project #8009

Closed
@sollyucko

Description

@sollyucko

Describe the problem you are trying to solve
cargo locate-project and cargo metadata both return JSON output, which may be easiest when writing programs to parse it, but it is much more difficult to use in simple shell scripts.

Describe the solution you'd like
A --output-format flag or similar might be the neatest way to solve this. For example, cargo locate-project --output-format minimal (or something similar) would return just the path to Cargo.toml. It could also be formatted as root path or something similar, allowing the use of grep + cut for parsing, and would be more generalizable and allow for future extension locate-project.

Additionally, this sort of flag could also be extended to other commands and formats, as needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-console-outputArea: Terminal output, colors, progress bar, etc.A-json-outputArea: JSON message outputC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Command-locate-project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions