mirror of
https://github.com/clap-rs/clap
synced 2024-12-12 22:02:35 +00:00
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:
parent
2cb0bbf7b4
commit
32b5520ff1
10 changed files with 20 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// Note: this requires the `derive` attribute
|
||||
|
||||
use clap::Parser;
|
||||
|
||||
/// Simple program to greet a person
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// Note: this requires the `cargo` feature
|
||||
|
||||
use clap::{app_from_crate, arg};
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// Note: this requires the `derive` attribute
|
||||
|
||||
use clap::Parser;
|
||||
|
||||
#[derive(Parser)]
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// Note: this requires the `derive` attribute
|
||||
|
||||
use std::ffi::OsString;
|
||||
use std::path::PathBuf;
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
*Jump to [source](keyvalue_derive.rs)*
|
||||
|
||||
**This requires enabling the `derive` feature flag.**
|
||||
|
||||
```bash
|
||||
$ keyvalue_derive --help
|
||||
clap
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// Note: this requires the `derive` attribute
|
||||
|
||||
use clap::Parser;
|
||||
use std::error::Error;
|
||||
|
||||
|
|
Loading…
Reference in a new issue