Is there a crate to test example commands in clap command/subcommand documentation? #4500
Answered
by
epage
jpmckinney
asked this question in
Q&A
-
I'm looking for something like https://docs.rs/trycmd/latest/trycmd/ that extracts test cases from the documentation for a clap command/subcommand. For example: enum Commands {
/// Counts from START to STOP.
///
/// $ mycli counter 1 3
/// 1
/// 2
/// 3
Counter {
start: usize,
stop: usize,
}
} And then it'll run
|
Beta Was this translation helpful? Give feedback.
Answered by
epage
Nov 21, 2022
Replies: 1 comment
-
At the moment, trycmd only supported markdown and not code blocks. Feel free to open an issue about that though it does introduce some complexity that I'm unsure if I want to handle and the use case seems a lot smaller, lowering the priority. One alternative is to pull a markdown file into your doc comment |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
jpmckinney
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
At the moment, trycmd only supported markdown and not code blocks.
Feel free to open an issue about that though it does introduce some complexity that I'm unsure if I want to handle and the use case seems a lot smaller, lowering the priority.
One alternative is to pull a markdown file into your doc comment