diff options
Diffstat (limited to 'vendor/clap/src/_tutorial.rs')
-rw-r--r-- | vendor/clap/src/_tutorial.rs | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/vendor/clap/src/_tutorial.rs b/vendor/clap/src/_tutorial.rs index 4605ec9a1..58e527cbc 100644 --- a/vendor/clap/src/_tutorial.rs +++ b/vendor/clap/src/_tutorial.rs @@ -23,6 +23,7 @@ //! 3. [Argument Relations](#argument-relations) //! 4. [Custom Validation](#custom-validation) //! 5. [Testing](#testing) +//! 6. [Next Steps](#next-steps) //! //! See also //! - [FAQ: When should I use the builder vs derive APIs?][crate::_faq#when-should-i-use-the-builder-vs-derive-apis] @@ -32,6 +33,11 @@ //! //! You can create an application with several arguments using usage strings. //! +//! First, ensure `clap` is available: +//! ```console +//! $ cargo add clap +//! ``` +//! //! ```rust #![doc = include_str!("../examples/tutorial_builder/01_quick.rs")] //! ``` @@ -57,7 +63,7 @@ #![doc = include_str!("../examples/tutorial_builder/02_crate.md")] //! //! You can use [`Command`][crate::Command] methods to change the application level behavior of -//! clap. +//! clap, like [`Command::next_line_help`]. //! //! ```rust #![doc = include_str!("../examples/tutorial_builder/02_app_settings.rs")] @@ -76,7 +82,7 @@ #![doc = include_str!("../examples/tutorial_builder/03_03_positional.md")] //! //! Note that the default [`ArgAction`][crate::ArgAction] is [`Set`][crate::ArgAction::Set]. To -//! accept multiple values, use [`Append`][crate::ArgAction::Append]: +//! accept multiple values, override the [action][Arg::action] with [`Append`][crate::ArgAction::Append]: //! ```rust #![doc = include_str!("../examples/tutorial_builder/03_03_positional_mult.rs")] //! ``` @@ -95,7 +101,7 @@ #![doc = include_str!("../examples/tutorial_builder/03_02_option.md")] //! //! Note that the default [`ArgAction`][crate::ArgAction] is [`Set`][crate::ArgAction::Set]. To -//! accept multiple occurrences, use [`Append`][crate::ArgAction::Append]: +//! accept multiple occurrences, override the [action][Arg::action] with [`Append`][crate::ArgAction::Append]: //! ```rust #![doc = include_str!("../examples/tutorial_builder/03_02_option_mult.rs")] //! ``` @@ -169,14 +175,14 @@ //! //! ### Validated values //! -//! More generally, you can validate and parse into any data type. +//! More generally, you can validate and parse into any data type with [`Arg::value_parser`]. //! //! ```rust #![doc = include_str!("../examples/tutorial_builder/04_02_parse.rs")] //! ``` #![doc = include_str!("../examples/tutorial_builder/04_02_parse.md")] //! -//! A custom parser can be used to improve the error messages or provide additional validation: +//! A [custom parser][TypedValueParser] can be used to improve the error messages or provide additional validation: //! //! ```rust #![doc = include_str!("../examples/tutorial_builder/04_02_validate.rs")] @@ -220,3 +226,17 @@ //! ```rust,no_run #![doc = include_str!("../examples/tutorial_builder/05_01_assert.rs")] //! ``` +//! +//! ## Next Steps +//! +//! - [Cookbook][crate::_cookbook] for application-focused examples +//! - Explore more features in the [API reference][super] +//! +//! For support, see [Discussions](https://github.com/clap-rs/clap/discussions) + +#![allow(unused_imports)] +use crate::builder::Arg; +use crate::builder::ArgGroup; +use crate::builder::Command; +use crate::builder::PossibleValue; +use crate::builder::TypedValueParser; |