@@ -33,7 +33,7 @@ Create your command-line parser, with all of the bells and whistles, declarative
3333
3434This uses our
3535[ Derive API] ( https://github.com/clap-rs/clap/blob/v3.0.10/examples/derive_ref/README.md )
36- which provides access to the Builder API as attributes on a ` struct ` :
36+ which provides access to the [ Builder API] ( https://docs.rs/clap ) as attributes on a ` struct ` :
3737
3838<!-- Copied from examples/demo.{rs,md} -->
3939``` rust,no_run
@@ -102,6 +102,20 @@ get. Check out the
102102[ argparse-benchmarks] ( https://github.com/rust-cli/argparse-benchmarks-rs ) for
103103CLI parsers optimized for other use cases.
104104
105+ ### Selecting an API
106+
107+ Why use the declarative [ Derive API] ( https://github.com/clap-rs/clap/blob/v3.0.10/examples/tutorial_derive/README.md ) :
108+ - Easier to read, write, and modify
109+ - Easier to keep the argument declaration and reading of argument in sync
110+ - Easier to reuse, e.g. [ clap-verbosity-flag] ( https://crates.io/crates/clap-verbosity-flag )
111+
112+ Why use the procedural [ Builder API] ( https://github.com/clap-rs/clap/blob/v3.0.10/examples/tutorial_builder/README.md ) :
113+ - Faster compile times if you aren't already using other procedural macros
114+ - More flexible, e.g. you can look up how many times an argument showed up,
115+ what its values were, and what were the indexes of those values. The Derive
116+ API can only report presence, number of occurrences, or values but no indices
117+ or combinations of data.
118+
105119### Related Projects
106120
107121- [ wild] ( https://crates.io/crates/wild ) for supporting wildcards (` * ` ) on Windows like you do Linux
0 commit comments