clap/clap_derive/examples
2021-10-09 11:12:50 -04:00
..
after_help.rs Merged clap_derive using git-subtree 2020-01-18 17:40:07 +05:30
arg_enum.rs ArgEnum: Slice instead of array, from_str in ArgEnum implemented 2021-09-29 18:33:43 +02:00
at_least_two.rs Merged clap_derive using git-subtree 2020-01-18 17:40:07 +05:30
basic.rs Add examples for using value_hint with clap_derive 2020-10-10 00:11:44 +03:00
deny_missing_docs.rs Merged clap_derive using git-subtree 2020-01-18 17:40:07 +05:30
doc_comments.rs Updated test and usage of older help APIs with about 2020-04-27 02:42:07 +05:30
enum_tuple.rs Merged clap_derive using git-subtree 2020-01-18 17:40:07 +05:30
env.rs Update the env var example for derive 2020-08-23 18:18:25 -05:00
example.rs chore: silence warning in example code 2021-10-09 11:12:50 -04:00
flatten.rs Merged clap_derive using git-subtree 2020-01-18 17:40:07 +05:30
from_crate.rs Fix various typos in docs & code 2020-07-19 03:10:28 +03:00
git.rs Merged clap_derive using git-subtree 2020-01-18 17:40:07 +05:30
group.rs Rename with_name to new for Arg & ArgGroup 2020-05-14 22:50:56 +02:00
keyvalue.rs Fix keyvalue example 2021-08-30 04:52:35 +02:00
negative_flag.rs Merged clap_derive using git-subtree 2020-01-18 17:40:07 +05:30
README.md Add examples for using value_hint with clap_derive 2020-10-10 00:11:44 +03:00
rename_all.rs Merged clap_derive using git-subtree 2020-01-18 17:40:07 +05:30
skip.rs Fix warnings in tests & examples 2020-03-05 13:40:25 +03:00
subcommand_aliases.rs Merged clap_derive using git-subtree 2020-01-18 17:40:07 +05:30
true_or_false.rs Merged clap_derive using git-subtree 2020-01-18 17:40:07 +05:30
value_hints_derive.rs tests(Examples): fixes examples for no-auto generated version 2021-10-09 11:06:48 -04:00

Collection of examples "how to use clap_derive"

Help on the bottom

How to append a postscript to the help message generated.

Arg Enum

How to use ArgEnum

At least N

How to require presence of at least N values, like val1 val2 ... valN ... valM.

Basic

A basic example how to use clap_derive.

Deny missing docs

This is not an example but a test, it should be moved to tests folder as soon as this is fixed (if ever).

Doc comments

How to use doc comments in place of help/long_help.

Arguments of subcommands in separate struct

How to extract subcommands' args into external structs.

Environment variables

How to use environment variable fallback an how it interacts with default_value.

Advanced

Somewhat complex example of usage of clap_derive.

Flatten

How to use #[clap(flatten)]

Git

Pseudo-git example, shows how to use subcommands and how to document them.

Groups

Using clap::Arg::group with clap.

key=value pairs

How to parse key=value pairs.

--no-* flags

How to add no-thing flag which is true by default and false if passed.

Rename all

How #[clap(rename_all)] works.

Skip

How to use #[clap(skip)].

Aliases

How to use aliases

true or false

How to express ""true" or "false" argument.

Author, description, and version from Cargo.toml

How to derive the author, description, and version from Cargo.toml

Value hints for shell completion

How to provide ValueHint attributes and generate shell completion files.