Skip to content

cargo run --example should print available examples #2548

Closed
@tyoc213

Description

@tyoc213

if you clone a repo and has examples and you run cargo run --example you only get help for general usage, what about print the actual examples on the examples directory?

$ cargo run --example
Expected argument for flag '--example' but reached end of arguments.

Usage:
    cargo run [options] [--] [<args>...]

If there where one.rs, two.rs and three.rs inside examples folder it could output something like

$ cargo run --example
Expected argument for flag '--example' but reached end of arguments.

Available examples are: one, two and three.

Usage:
    cargo run [options] [--] [<args>...]

Even more, it can autocomplete the name of the example... well that will be only a NTH.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Error and warning messages generated by Cargo itself.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions