Debian Codegraph @

third_party/rust/clap/src/_derive/_tutorial/chapter_1.rs

raw
1 //! ## Configuring the Parser
2 //!
3 //! You use derive [`Parser`][crate::Parser] to start building a parser.
4 //!
5 //! ```rust
6 #![doc = include_str!("../../../examples/tutorial_derive/02_apps.rs")]
7 //! ```
8 //!
9 #![doc = include_str!("../../../examples/tutorial_derive/02_apps.md")]
10 //!
11 //! You can use [`#[command(version, about)]` attribute defaults][super#command-attributes] on the struct to fill these fields in from your `Cargo.toml` file.
12 //!
13 //! ```rust
14 #![doc = include_str!("../../../examples/tutorial_derive/02_crate.rs")]
15 //! ```
16 #![doc = include_str!("../../../examples/tutorial_derive/02_crate.md")]
17 //!
18 //! 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`].
19 //!
20 //! ```rust
21 #![doc = include_str!("../../../examples/tutorial_derive/02_app_settings.rs")]
22 //! ```
23 #![doc = include_str!("../../../examples/tutorial_derive/02_app_settings.md")]
24 #![allow(unused_imports)]
25 use crate::builder::*;
26
27 pub use super::chapter_0 as previous;
28 pub use super::chapter_2 as next;
29 pub use crate::_derive::_tutorial as table_of_contents;