a065702205
From a users perspective, `clap_derive` is baked into `clap`. `clap_generate is an add on to `clap`. So it seems best to have all `clap_generate` examples in `clap_generate` where a user will look for them. Fixes #2939 |
||
---|---|---|
.. | ||
after_help.rs | ||
arg_enum.rs | ||
at_least_two.rs | ||
basic.rs | ||
deny_missing_docs.rs | ||
doc_comments.rs | ||
enum_tuple.rs | ||
env.rs | ||
example.rs | ||
flatten.rs | ||
from_crate.rs | ||
git.rs | ||
group.rs | ||
keyvalue.rs | ||
negative_flag.rs | ||
README.md | ||
rename_all.rs | ||
skip.rs | ||
subcommand_aliases.rs | ||
true_or_false.rs |
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.