Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(tutorial): Split into separate modules per section #5122

Merged
merged 2 commits into from Sep 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
255 changes: 0 additions & 255 deletions src/_derive/_tutorial.rs

This file was deleted.

25 changes: 25 additions & 0 deletions src/_derive/_tutorial/chapter_0.rs
@@ -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;
29 changes: 29 additions & 0 deletions src/_derive/_tutorial/chapter_1.rs
@@ -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;