-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
flatten
causes the wrong doc-comment to be respected
#3127
Comments
Comment by epage Based on reports (clap-rs/clap-verbosity-flag#20) I'm guessing TeXitoi/structopt@e2270de broke this |
Comment by CreepySkeleton
But there's no user specified help here as far as I can see 😕 |
Comment by epage /// Foo
struct Cli { The user's doc-comment is being overridden by the doc-comment from the chain. Instead of "Foo", we're getting library documentation |
Comment by CreepySkeleton This is caused by #290 since doc comments on top of struct/enum are top level attributes too :( |
Comment by ssokolow I just noticed that this also causes the doc comment on my boilerplate opts (which get flattened into the main struct) to override the I'm really starting to feel like I need to write a regression/integration suite on my |
Comment by pizzamig
Is there any update or way to fix this? The complexity of structopt is too high for me right now to try to find a fix. thanks in advance |
Comment by CreepySkeleton I tried to fix it. I couldn't. I'll take another round a bit later. |
Comment by vorner Hello I guess the „proper“ way to fix it will be hard and will take time (I'm not sure if reordering the calls inside the But if it is hard, would it make sense to add some kind of |
Comment by TeXitoi By default, there is no about, but doc comment are |
Comment by vorner I've figured that, but it is kind of bad for structs provided by libraries. I want to have doc comment to render on docs.rs, I also tend to But as the author of the library I know my struct should not be used directly and that it should never provide the https://docs.rs/spirit-daemonize/0.3.2/spirit_daemonize/struct.Opts.html Maybe the right name would be |
Comment by vorner Just for the record, I've figured a workaround that keeps them for the docs.rs, but doesn't hijacks them for the about:
It simply enables the doc comment only for the documentation generation (and seems to work with doc tests too) |
Comment by TeXitoi I've put a link to your workaround in the description of the issue for ease of access. |
Assuming this is a valid reproduction case, this is fixed use clap::StructOpt;
#[derive(Debug, StructOpt)]
#[structopt(name = "structopt-bug", about = "Show a bug in Structopt")]
struct Opt {
#[structopt(flatten)]
v: Verbose,
}
/// Re-usable Verbose flag
#[derive(Debug, StructOpt)]
struct Verbose {
/// Enable the verbosity messages
#[structopt(short)]
verbose: bool,
}
fn main() {
let opt = Opt::from_args();
println!("{:?}", opt);
}
|
To add, we still have #2983 which is about about/long_about interactions being weird |
Issue by epage
Thursday Jan 16, 2020 at 13:46 GMT
Originally opened as TeXitoi/structopt#333
With
clap-verbosity-flag
"3.0.0"will cause clap-verbosity-flag's documentation to be used for the help instead of the user-specified one
I am working around it in clap-verbosity-flag by. not providing a doc comment (clap-rs/clap-verbosity-flag#21).
A workaround is explained in TeXitoi/structopt#333 (comment)
The text was updated successfully, but these errors were encountered: