Description
Problem
In a project with multiple binaries, examples, tests, benches or packages commands like cargo run
, cargo run --bin
cargo run --example
, cargo test --bench
will generate an error with the list of available targets and remind the user to pick one of them. This is a good user experience as it helps the user easily discover what targets are available. I think this experience could be improved if the targets where outputted using ANSI hyperlinks, where package targets would be formatted to have a hyperlink to the file path of the crates Cargo.toml
and binary targets like --bin
and --example
would be the file path to the file containing its main
function. With this the user can easily click on the target if it's unclear where the target orginates from or how its defined and have the file open in their editor.
Proposed Solution
Change print_available_targets()
and print_available_packages()
in src/cargo/util/workspace.rs
to use Shell
to format each target as a hyperlink.
Notes
No response