docs: Call out features used in root examples

mitsuhiko immediately jumped into the examples and got tripped up by the
lack of documentation on feature flags needed.

I limited this to just the root ones because the rest are in a more
proper tutorial that steps through it all.
This commit is contained in:
Ed Page 2021-12-08 16:46:49 -06:00
parent 2cb0bbf7b4
commit 32b5520ff1
10 changed files with 20 additions and 0 deletions

View file

@ -1,5 +1,7 @@
*Jump to [source](demo.rs)*
**This requires enabling the `derive` feature flag.**
Used to validate README.md's content
```bash
$ demo --help

View file

@ -1,3 +1,5 @@
// Note: this requires the `derive` attribute
use clap::Parser;
/// Simple program to greet a person

View file

@ -1,5 +1,7 @@
*Jump to [source](escaped_positional.rs)*
**This requires enabling the `cargo` feature flag.**
You can use `--` to escape further arguments.
Let's see what this looks like in the help:

View file

@ -1,3 +1,5 @@
// Note: this requires the `cargo` feature
use clap::{app_from_crate, arg};
fn main() {

View file

@ -1,5 +1,7 @@
*Jump to [source](escaped_positional_derive.rs)*
**This requires enabling the `derive` feature flag.**
You can use `--` to escape further arguments.
Let's see what this looks like in the help:

View file

@ -1,3 +1,5 @@
// Note: this requires the `derive` attribute
use clap::Parser;
#[derive(Parser)]

View file

@ -1,5 +1,7 @@
*Jump to [source](git_derive.rs)*
**This requires enabling the `derive` feature flag.**
Git is an example of several common subcommand patterns.
Help:

View file

@ -1,3 +1,5 @@
// Note: this requires the `derive` attribute
use std::ffi::OsString;
use std::path::PathBuf;

View file

@ -1,5 +1,7 @@
*Jump to [source](keyvalue_derive.rs)*
**This requires enabling the `derive` feature flag.**
```bash
$ keyvalue_derive --help
clap

View file

@ -1,3 +1,5 @@
// Note: this requires the `derive` attribute
use clap::Parser;
use std::error::Error;