Skip to content
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

Support for test cases in documentation comments #171

Open
jpmckinney opened this issue Nov 22, 2022 · 0 comments
Open

Support for test cases in documentation comments #171

jpmckinney opened this issue Nov 22, 2022 · 0 comments
Labels
A-trycmd Area: trycmd package enhancement Improve the expected

Comments

@jpmckinney
Copy link

jpmckinney commented Nov 22, 2022

I use clap, and I put examples in the documentation comments for my commands/subcommands like:

enum Commands {
    /// Counts from START to STOP.
    ///
    /// $ mycli counter 1 3
    /// 1
    /// 2
    /// 3
    Counter {
        start: usize,
        stop: usize,
    }
}

From discussion in clap-rs/clap#4500

One alternative is to pull a markdown file into your doc comment

e.g. #[doc = include_str!("../../README.md")]

@epage epage added enhancement Improve the expected A-trycmd labels Nov 22, 2022
@settings settings bot removed the A-trycmd label Aug 14, 2023
@epage epage added the A-trycmd Area: trycmd package label Aug 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-trycmd Area: trycmd package enhancement Improve the expected
Projects
None yet
Development

No branches or pull requests

2 participants