No longer abusing external_subcommand, but using subcmd_name in order to
parse a subcommand, added a `keep_state` variable in order to handle the
hacky solution of short command line arguments.
1995: Move to terminal_size dep after the recent textwrap upgrade r=CreepySkeleton a=pksunkara
Co-authored-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
1992: fix(clap_derive): Unwrap `syn::TypeGroup` when checking field types r=CreepySkeleton a=Aaron1011
Co-authored-by: Aaron Hill <aa1ronham@gmail.com>
Due to macro expansions, a `syn` type may be wrapped in multiple
'layers' of `syn::Type::Group`. However, `clap_derive` currently does
not check for `syn::Type::Group`, which will cause an `Option` (along
with other matched types) to fail to be detected when it results from a
macro expansion.
This commit 'unwraps' outer type groups before checking the
user-provided types against well-known types. Currently, these groups
may not be present due to a rustc bug (rust-lang/rust#43081)
However, once https://github.com/rust-lang/rust/pull/73084 is merged,
these groups will be present in more cases. This commit makes `clap`
compatible with both older and newer versions of rustc.
The other examples have `verbosity` as a default arg, and `debug` as a `test` subcommand arg. The macro example has these two switched up -- this corrects that.
1980: Removed word duplicate from docs for allow_hyphen_values r=pksunkara a=kamilogorek
1985: docs(README.md): Fixes typo at line 413 r=CreepySkeleton a=ewilazarus
Co-authored-by: Kamil Ogórek <kamil.ogorek@gmail.com>
Co-authored-by: Gabriel Lima <ewilazarus@users.noreply.github.com>
This PR switches the Arg::Short macro to take a character instead of a string. It removes the hacky code in the Method to_token method and implements the logic for Short when parsing the clap derive arguments.
Fixes#1815.
Improved printing instead of printing out the `Vec` using `{:?}`,
`join(", ")` for improved printing. Improved documentation to b emore
explicit and apply to removal of `FlagSubCommand` -> `App::short_flag`
and `App::long_flag`
Instead of a `FlagSubCommand` struct the addition of two simple methods
to `App`. `App::long_flag` and `App::short_flag` that cover all the
bases of the many methods that were provided in `FlagSubCommand`. This
API is far simpler to use and more akin to the present `Arg::long` and `Arg::short`.