clap/examples
Ed Page 31b22d1a51 perf(parser): Take up less memory with ArgAction::Count
Someone should not reasonably expect a coun flag to go up to billions,
millions, or even thousands.  255 should be sufficient for anyone,
right?

The original type was selected to be consistent with
`ArgMatches::occurrences_of` but that is also used for tracking how
many values appear which can be large with `xargs`.

I'm still conflicted on what the "right type" is an wish we could
support any numeric type.  When I did a search on github though, every
case was for debug/quiet flags and only supported 2-3 occurrences,
making a `u8` overkill.

This came out of a discussion on #3792
2022-06-09 11:09:38 -05:00
..
derive_ref fix(derive): Clarify ArgEnum as ValueEnum 2022-06-08 11:14:09 -05:00
tutorial_builder perf(parser): Take up less memory with ArgAction::Count 2022-06-09 11:09:38 -05:00
tutorial_derive perf(parser): Take up less memory with ArgAction::Count 2022-06-09 11:09:38 -05:00
cargo-example-derive.md docs: Fix messed up highlighting 2022-01-05 11:53:06 -06:00
cargo-example-derive.rs doc(derive): Update for value_parser 2022-05-20 20:02:23 -05:00
cargo-example.md fix(parser): Simplify the common getter API 2022-05-25 10:50:42 -05:00
cargo-example.rs docs(example): Update for value_parser 2022-05-24 14:53:08 -05:00
demo.md docs: Fix messed up highlighting 2022-01-05 11:53:06 -06:00
demo.rs doc(derive): Update for value_parser 2022-05-20 20:02:23 -05:00
escaped-positional-derive.md docs: Fix messed up highlighting 2022-01-05 11:53:06 -06:00
escaped-positional-derive.rs feat(derive): Expose control over Actions 2022-06-06 11:35:07 -05:00
escaped-positional.md docs: Fix messed up highlighting 2022-01-05 11:53:06 -06:00
escaped-positional.rs fix(parser): Deprecate multiple_occurrences 2022-06-08 09:54:23 -05:00
git-derive.md docs: Fix examples 2022-03-23 12:31:13 -05:00
git-derive.rs doc(derive): Update for value_parser 2022-05-20 20:02:23 -05:00
git.md docs(examples): Fix help output 2022-03-25 07:20:46 -05:00
git.rs fix(parser): Simplify the common getter API 2022-05-25 10:50:42 -05:00
multicall-busybox.md docs: Update App references to Command 2022-02-14 15:33:49 -06:00
multicall-busybox.rs fix(parser): Deprecate occurrences_of 2022-06-07 13:30:32 -05:00
multicall-hostname.md docs: Update App references to Command 2022-02-14 15:33:49 -06:00
multicall-hostname.rs feat(multicall): Stablize multicall 2022-05-20 12:20:40 -05:00
pacman.md fix(help): Use standard alternate syntax for subcommands 2022-02-14 21:18:33 -06:00
pacman.rs fix(parser): Simplify the common getter API 2022-05-25 10:50:42 -05:00
README.md fix cargo.toml link 2022-05-27 07:43:09 -04:00
repl.rs feat(multicall): Stablize multicall 2022-05-20 12:20:40 -05:00
typed-derive.md docs(examples): Show IP Address 2022-03-14 09:53:31 -05:00
typed-derive.rs fix(parser): Deprecate multiple_occurrences 2022-06-08 09:54:23 -05:00

Examples

  • Basic demo: derive
  • Typed arguments: derive
    • Topics:
      • Custom parse()
  • Custom cargo command: builder, derive
    • Topics:
      • Subcommands
      • Cargo plugins
  • git-like interface: builder, derive
    • Topics:
      • Subcommands
      • External subcommands
      • Optional subcommands
      • Default subcommands
  • pacman-like interface: builder
    • Topics:
      • Flag subcommands
      • Conflicting arguments
  • Escaped positionals with --: builder, derive
  • Multi-call
    • busybox: builder
      • Topics:
        • Subcommands
    • hostname: builder
      • Topics:
        • Subcommands
  • repl: builder
    • Topics:
      • Read-Eval-Print Loops / Custom command lines

Contributing

New examples:

  • Building: They must be added to Cargo.toml with the appropriate required-features.
  • Testing: Ensure there is a markdown file with trycmd syntax
  • Link the .md file from here

See also the general CONTRIBUTING.