docs(derive): Link to ref from traits

This is to help with #3189
This commit is contained in:
Ed Page 2021-12-30 14:41:21 -06:00
parent ea02f6125d
commit 29d4508e2a
2 changed files with 17 additions and 0 deletions

View file

@ -50,6 +50,7 @@ pre-release-replacements = [
{file="CHANGELOG.md", search="<!-- next-url -->", replace="<!-- next-url -->\n[Unreleased]: https://github.com/clap-rs/clap/compare/{{tag_name}}...HEAD", exactly=1}, {file="CHANGELOG.md", search="<!-- next-url -->", replace="<!-- next-url -->\n[Unreleased]: https://github.com/clap-rs/clap/compare/{{tag_name}}...HEAD", exactly=1},
{file="README.md", search="github.com/clap-rs/clap/blob/[^/]+/", replace="github.com/clap-rs/clap/blob/{{tag_name}}/", exactly=9, prerelease = true}, {file="README.md", search="github.com/clap-rs/clap/blob/[^/]+/", replace="github.com/clap-rs/clap/blob/{{tag_name}}/", exactly=9, prerelease = true},
{file="README.md", search="version = \"[a-z0-9\\.-]+\"", replace="version = \"{{version}}\"", exactly=1, prerelease = true}, {file="README.md", search="version = \"[a-z0-9\\.-]+\"", replace="version = \"{{version}}\"", exactly=1, prerelease = true},
{file="src/derive.rs", search="github.com/clap-rs/clap/blob/[^/]+/", replace="github.com/clap-rs/clap/blob/{{tag_name}}/", exactly=4, prerelease = true},
] ]
[features] [features]

View file

@ -19,6 +19,10 @@ use std::ffi::OsString;
/// ///
/// See also [`Subcommand`] and [`Args`]. /// See also [`Subcommand`] and [`Args`].
/// ///
/// See the
/// [derive reference](https://github.com/clap-rs/clap/blob/v3.0.0-rc.10/examples/derive_ref/README.md)
/// for attributes and best practices.
///
/// **NOTE:** Deriving requires the `derive` feature flag /// **NOTE:** Deriving requires the `derive` feature flag
/// ///
/// # Examples /// # Examples
@ -280,6 +284,10 @@ pub trait FromArgMatches: Sized {
/// `Args`. /// `Args`.
/// - `Variant(ChildArgs)`: No attribute is used with enum variants that impl `Args`. /// - `Variant(ChildArgs)`: No attribute is used with enum variants that impl `Args`.
/// ///
/// See the
/// [derive reference](https://github.com/clap-rs/clap/blob/v3.0.0-rc.10/examples/derive_ref/README.md)
/// for attributes and best practices.
///
/// **NOTE:** Deriving requires the `derive` feature flag /// **NOTE:** Deriving requires the `derive` feature flag
/// ///
/// # Example /// # Example
@ -320,6 +328,10 @@ pub trait Args: FromArgMatches + Sized {
/// - `#[clap(flatten)] Variant(SubCmd)`: Attribute can only be used with enum variants that impl /// - `#[clap(flatten)] Variant(SubCmd)`: Attribute can only be used with enum variants that impl
/// `Subcommand`. /// `Subcommand`.
/// ///
/// See the
/// [derive reference](https://github.com/clap-rs/clap/blob/v3.0.0-rc.10/examples/derive_ref/README.md)
/// for attributes and best practices.
///
/// **NOTE:** Deriving requires the `derive` feature flag /// **NOTE:** Deriving requires the `derive` feature flag
/// ///
/// # Example /// # Example
@ -360,6 +372,10 @@ pub trait Subcommand: FromArgMatches + Sized {
/// - Call [`Arg::possible_values`][crate::Arg::possible_values] /// - Call [`Arg::possible_values`][crate::Arg::possible_values]
/// - Allowing using the `#[clap(default_value_t)]` attribute without implementing `Display`. /// - Allowing using the `#[clap(default_value_t)]` attribute without implementing `Display`.
/// ///
/// See the
/// [derive reference](https://github.com/clap-rs/clap/blob/v3.0.0-rc.10/examples/derive_ref/README.md)
/// for attributes and best practices.
///
/// **NOTE:** Deriving requires the `derive` feature flag /// **NOTE:** Deriving requires the `derive` feature flag
/// ///
/// # Example /// # Example