clap/clap_derive/examples
2020-02-13 18:29:51 +03:00
..
after_help.rs Merged clap_derive using git-subtree 2020-01-18 17:40:07 +05:30
arg_enum_basic.rs Merged clap_derive using git-subtree 2020-01-18 17:40:07 +05:30
arg_enum_case_sensitive.rs Merged clap_derive using git-subtree 2020-01-18 17:40:07 +05:30
at_least_two.rs Merged clap_derive using git-subtree 2020-01-18 17:40:07 +05:30
basic.rs Merged clap_derive using git-subtree 2020-01-18 17:40:07 +05:30
deny_missing_docs.rs Merged clap_derive using git-subtree 2020-01-18 17:40:07 +05:30
doc_comments.rs Merged clap_derive using git-subtree 2020-01-18 17:40:07 +05:30
enum_in_args.rs Merged clap_derive using git-subtree 2020-01-18 17:40:07 +05:30
enum_tuple.rs Merged clap_derive using git-subtree 2020-01-18 17:40:07 +05:30
env.rs Merged clap_derive using git-subtree 2020-01-18 17:40:07 +05:30
example.rs Remove some mentioning of structopt 2020-02-13 18:29:51 +03:00
flatten.rs Merged clap_derive using git-subtree 2020-01-18 17:40:07 +05:30
from_crate.rs Get rid of #[clap(no_version)] 2020-02-05 16:54:58 +03:00
git.rs Merged clap_derive using git-subtree 2020-01-18 17:40:07 +05:30
group.rs Merged clap_derive using git-subtree 2020-01-18 17:40:07 +05:30
keyvalue.rs Remove some mentioning of structopt 2020-02-13 18:29:51 +03:00
negative_flag.rs Merged clap_derive using git-subtree 2020-01-18 17:40:07 +05:30
README.md Get rid of #[clap(no_version)] 2020-02-05 16:54:58 +03:00
rename_all.rs Merged clap_derive using git-subtree 2020-01-18 17:40:07 +05:30
skip.rs Remove some mentioning of structopt 2020-02-13 18:29:51 +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

Collection of examples "how to use clap_derive"

Help on the bottom

How to append a postscript to the help message generated.

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.

Enums as arguments

How to use arg_enum! with clap_derive.

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 a author, description, and version from Cargo.toml