`structopt` and crate readme/docs.rs documentation

I am a big fan of using the structopt crate for cli apps. I typically annotate my top-level options struct with a doc comment to define the help text for the app; this is also often what I would want to use as the contents of the README.md associated with the crate, or the top level documentation generated for docs.rs. Tools like cargo-readme are good for generating a readme from module doc comments, but doesn't pick up the documentation on the struct deriving StructOpt.

Is there a clever way to utilize a single comment block both for the help message associated with structopt usage, and will be picked up as top-level documentation for a README.md or docs.rs?

1 Like

maybe not the most elegant way, but you could write a build.rs file that scrapes the doc comment from your main.rs file and puts it into the readme

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.