-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make it easy to list and run all examples #8356
Comments
A tweak, to make the above work for individual crates:
Anything more complicated, including workspaces, need twiddles on the twiddles. Ah, this works for workspaces:
And better:
|
trycmd builds on top of |
Cargo-examples allows you to run all examples |
Came across a similar need today, trying to quickly see what paths in a workspace exist and are build/disabled by default. I can think of a few possible uses for a
|
|
The output of Also, |
Describe the problem you are trying to solve
Some project have a list of example, usually in the
example
folder. It would be nice if it was possible to:cargo run --example $name_of_the_example
)cargo test
, this should count the number of panic/non 0 exit codeDescribe the solution you'd like
I think a new command
cargo list
that would output (in separate sections) the list of examples, the list of binaries, and the list of libraries provided by the current crate would be a nice addition. It should be possible to filter the output with flags like--example
,--binaries
or--libraries
. Maybe the list of features available could also be listed?I think a new subcommand of
cargo run
should be added:cargo run --examples
. Like cargo run, all arguments after--
should be passed to the examples binaries. It would be equivalent to do:A flag
--exclude $example
may be added to run all examples but$example
(and would only make sense if--examples
is used). Similarly,cargo run --binaries
could be added to run all binaries of a crate.Notes
In some cases, like a 3d crate, or interactive example, it would not be wise to run all examples but I don't think it's an issue. The proposed
cargo list
andcargo run --examples
would still be really useful for most cases.The text was updated successfully, but these errors were encountered: