We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Consider the following application:
use structopt::StructOpt; /// Inner description #[derive(Debug, StructOpt)] struct OptInner {} /// Outer description #[derive(Debug, StructOpt)] struct OptOuter { #[structopt(flatten)] inner: OptInner } fn main() { OptOuter::from_args(); }
Running cargo run -- -h produces the following help text:
cargo run -- -h
test 0.1.0 Inner description USAGE: test FLAGS: -h, --help Prints help information -V, --version Prints version information
Note that the application description belongs to OptInner, not OptOuter as expected. Running cargo expand shows the issue:
OptInner
OptOuter
cargo expand
let app = app.about("Outer description"); let app = <OptInner as ::structopt::StructOptInternal>::augment_clap(app);
So this first applies the attributes of the outer structure and calls augment_clap() of the inner structure then which will overwrite them.
augment_clap()
The equivalent clap code does that in reverse order, producing the correct result:
let __clap_app = <OptInner as clap::Args>::augment_args(__clap_app); __clap_app.about("Outer description").long_about(None)
For reference: clap-rs/clap#2527
The text was updated successfully, but these errors were encountered:
Duplicate of #333
Sorry, something went wrong.
No branches or pull requests
Consider the following application:
Running
cargo run -- -h
produces the following help text:Note that the application description belongs to
OptInner
, notOptOuter
as expected. Runningcargo expand
shows the issue:So this first applies the attributes of the outer structure and calls
augment_clap()
of the inner structure then which will overwrite them.The equivalent clap code does that in reverse order, producing the correct result:
For reference: clap-rs/clap#2527
The text was updated successfully, but these errors were encountered: