-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5122 from epage/docs
docs(tutorial): Split into separate modules per section
- Loading branch information
Showing
17 changed files
with
591 additions
and
499 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
//! ## Quick Start | ||
//! | ||
//! You can create an application declaratively with a `struct` and some | ||
//! attributes. | ||
//! | ||
//! First, ensure `clap` is available with the [`derive` feature flag][crate::_features]: | ||
//! ```console | ||
//! $ cargo add clap --features derive | ||
//! ``` | ||
//! | ||
//! ```rust | ||
#![doc = include_str!("../../../examples/tutorial_derive/01_quick.rs")] | ||
//! ``` | ||
//! | ||
#![doc = include_str!("../../../examples/tutorial_derive/01_quick.md")] | ||
//! | ||
//! See also | ||
//! - [FAQ: When should I use the builder vs derive APIs?][crate::_faq#when-should-i-use-the-builder-vs-derive-apis] | ||
//! - The [cookbook][crate::_cookbook] for more application-focused examples | ||
|
||
#![allow(unused_imports)] | ||
use crate::builder::*; | ||
|
||
pub use super::chapter_1 as next; | ||
pub use crate::_tutorial as table_of_contents; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
//! ## Configuring the Parser | ||
//! | ||
//! You use derive [`Parser`][crate::Parser] to start building a parser. | ||
//! | ||
//! ```rust | ||
#![doc = include_str!("../../../examples/tutorial_derive/02_apps.rs")] | ||
//! ``` | ||
//! | ||
#![doc = include_str!("../../../examples/tutorial_derive/02_apps.md")] | ||
//! | ||
//! You can use [`#[command(author, version, about)]` attribute defaults][super#command-attributes] on the struct to fill these fields in from your `Cargo.toml` file. | ||
//! | ||
//! ```rust | ||
#![doc = include_str!("../../../examples/tutorial_derive/02_crate.rs")] | ||
//! ``` | ||
#![doc = include_str!("../../../examples/tutorial_derive/02_crate.md")] | ||
//! | ||
//! You can use `#[command]` attributes on the struct to change the application level behavior of clap. Any [`Command`][crate::Command] builder function can be used as an attribute, like [`Command::next_line_help`]. | ||
//! | ||
//! ```rust | ||
#![doc = include_str!("../../../examples/tutorial_derive/02_app_settings.rs")] | ||
//! ``` | ||
#![doc = include_str!("../../../examples/tutorial_derive/02_app_settings.md")] | ||
#![allow(unused_imports)] | ||
use crate::builder::*; | ||
|
||
pub use super::chapter_0 as previous; | ||
pub use super::chapter_2 as next; | ||
pub use crate::_tutorial as table_of_contents; |
Oops, something went wrong.