From 8824ad0df08b1cba750e44c72959c451218d6280 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Tue, 3 May 2022 15:44:54 -0500 Subject: [PATCH] docs(tutorial): Link derive to builder API --- examples/tutorial_derive/README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/examples/tutorial_derive/README.md b/examples/tutorial_derive/README.md index aecab8e4..706e76c0 100644 --- a/examples/tutorial_derive/README.md +++ b/examples/tutorial_derive/README.md @@ -171,6 +171,10 @@ You can name your arguments with a flag: - They can be optional - Intent is clearer +The `#[clap(short = 'c')]` and `#[clap(long = "name")]` attributes that define +the flags are `Arg` methods that are derived from the field name when no value +is specified (`#[clap(short)]` and `#[clap(long)]`). + [Example:](03_02_option.rs) ```console $ 03_02_option_derive --help @@ -207,7 +211,9 @@ name: Some("bob") ### Flags -Flags can also be switches that can be on/off: +Flags can also be switches that can be on/off. This is enabled via the +`#[clap(parse(from_flag)]` attribute though this is implied when the field is a +`bool`. [Example:](03_01_flag_bool.rs) ```console @@ -240,7 +246,7 @@ For more information try --help ``` -Or counted. +Or counted with `#[clap(parse(from_occurrences))]`: [Example:](03_01_flag_count.rs) ```console