TeXitoi / structopt

Parse command line arguments by defining a struct.
Other
2.7k stars 149 forks source link

Fix duplication of aliases in subcommands #504

Closed michiel-de-muynck closed 2 years ago

michiel-de-muynck commented 2 years ago

This PR fixes the issue where all top level methods were duplicated for subcommands with fields (see issue #418). For some attributes, such as aliases, this resulted in duplicate output.

The issue was caused by the fact that for named enum variants gen_augmentation was used to generate the clap data, which already parses the attributes, while later on attrs.top_level_methods() was used to parse attributes again, so that the attributes were parsed and generated twice. For some attributes, this merely resulted in the attribute being set twice, which is fairly harmless, but for some attributes, such as aliases, this resulted in the alias being added to the vector of aliases twice, which in turn causes the alias to be printed twice in the help message.

Fixes #418

TeXitoi commented 2 years ago

Thanks

TeXitoi commented 2 years ago

v0.3.24 published

TeXitoi commented 2 years ago

Sorry, bad publication, this PR is in v0.3.25