Open epage opened 2 years ago
Comment by epage Saturday Oct 16, 2021 at 15:05 GMT
Note: we can't just move the app method calls to IntoApp
because that will break subcommands because Args
and Subcommand
are also implicitly sub-parsers in subcommands and we expect them to be able to initialize the subcommand's app settings.
Options
Args
and Subcommand
also derive IntoApp
IntoApp
when they want to be used as a subcommandArgs
and Subcommand
augment_app
methods into augment_app
and add_args
.Comment by epage Tuesday Nov 02, 2021 at 17:57 GMT
In thinking about this, it might make sense for subcommand
to pull in some appsettings. We already implicitly add one we'd need to keep and the user might want to do other related ones like UseLongFormatForHelpSubcommand
, InferSubcommands
,
Issue by epage Saturday Oct 16, 2021 at 15:03 GMT Originally opened as https://github.com/clap-rs/clap/issues/2894
Please complete the following tasks
Rust Version
rustc 1.55.0 (c8dfcfe04 2021-09-06)
Clap Version
master
Minimal reproducible code
Steps to reproduce the bug with the above code
cargo run -- --help
Actual Behaviour
Expected Behaviour
Additional Context
With the vocabulary we are providing users, we are
flatten
ing anArgs
. This says nothing about flattening anApp
as well.This has also led to a series of bugs like #2527. We've worked around this by carefully setting the precedence (https://github.com/TeXitoi/structopt/pull/325, #2531 and #2819) which has lead to other bugs like #2785 which required more precedence tweaks (#2882).
By distinguishing what app settings are tightly associated with flattening (help_heading, the implicit subcommand required else help) and making everything else only apply when creating an App, we can simplify, clarify, and make less brittle these relationships.
Debug Output
No response