mirror of
https://github.com/clap-rs/clap
synced 2024-11-10 14:54:15 +00:00
docs(builder): Add ToC to Command, Arg
This commit is contained in:
parent
94e2727bd0
commit
3dd3993682
2 changed files with 24 additions and 11 deletions
|
@ -35,6 +35,12 @@ use crate::build::RegexRef;
|
|||
/// manually, or using a usage string which is far less verbose but has fewer options. You can also
|
||||
/// use a combination of the two methods to achieve the best of both worlds.
|
||||
///
|
||||
/// - [Basic API][crate::Arg#basic-api]
|
||||
/// - [Value Handling][crate::Arg#value-handling]
|
||||
/// - [Help][crate::Arg#help-1]
|
||||
/// - [Advanced Argument Relations][crate::Arg#advanced-argument-relations]
|
||||
/// - [Reflection][crate::Arg#reflection]
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```rust
|
||||
|
@ -91,6 +97,7 @@ pub struct Arg<'help> {
|
|||
pub(crate) value_hint: ValueHint,
|
||||
}
|
||||
|
||||
/// # Basic API
|
||||
impl<'help> Arg<'help> {
|
||||
/// Create a new [`Arg`] with a unique name.
|
||||
///
|
||||
|
@ -946,7 +953,7 @@ impl<'help> Arg<'help> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Value handling
|
||||
/// # Value Handling
|
||||
impl<'help> Arg<'help> {
|
||||
/// Specifies that the argument takes a value at run time.
|
||||
///
|
||||
|
@ -2727,7 +2734,7 @@ impl<'help> Arg<'help> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Help
|
||||
/// # Help
|
||||
impl<'help> Arg<'help> {
|
||||
/// Sets the description of the argument for short help (`-h`).
|
||||
///
|
||||
|
@ -3284,7 +3291,7 @@ impl<'help> Arg<'help> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Advanced argument relations
|
||||
/// # Advanced Argument Relations
|
||||
impl<'help> Arg<'help> {
|
||||
/// The name of the [`ArgGroup`] the argument belongs to.
|
||||
///
|
||||
|
@ -4489,7 +4496,7 @@ impl<'help> Arg<'help> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Reflection
|
||||
/// # Reflection
|
||||
impl<'help> Arg<'help> {
|
||||
/// Get the name of the argument
|
||||
#[inline]
|
||||
|
@ -4800,7 +4807,7 @@ impl<'help> Arg<'help> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Deprecated
|
||||
/// # Deprecated
|
||||
impl<'help> Arg<'help> {
|
||||
/// Deprecated, replaced with [`Arg::new`]
|
||||
#[deprecated(since = "3.0.0", note = "Replaced with `Arg::new`")]
|
||||
|
@ -5017,7 +5024,7 @@ impl<'help> Arg<'help> {
|
|||
}
|
||||
}
|
||||
|
||||
// Internally used only
|
||||
/// # Internally used only
|
||||
impl<'help> Arg<'help> {
|
||||
pub(crate) fn _build(&mut self) {
|
||||
if self.is_positional() {
|
||||
|
|
|
@ -43,6 +43,12 @@ use crate::build::debug_asserts::assert_app;
|
|||
/// [`CommandFactory::into_app`][crate::CommandFactory::into_app] to access the
|
||||
/// `Command`.
|
||||
///
|
||||
/// - [Basic API][crate::App#basic-api]
|
||||
/// - [Application-wide Settings][crate::App#application-wide-settings]
|
||||
/// - [Command-specific Settings][crate::App#command-specific-settings]
|
||||
/// - [Subcommand-specific Settings][crate::App#subcommand-specific-settings]
|
||||
/// - [Reflection][crate::App#reflection]
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```no_run
|
||||
|
@ -103,7 +109,7 @@ pub struct App<'help> {
|
|||
subcommand_heading: Option<&'help str>,
|
||||
}
|
||||
|
||||
/// Basic API
|
||||
/// # Basic API
|
||||
impl<'help> App<'help> {
|
||||
/// Creates a new instance of an `Command`.
|
||||
///
|
||||
|
@ -837,7 +843,7 @@ impl<'help> App<'help> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Application-wide (i.e. global) Settings
|
||||
/// # Application-wide Settings
|
||||
///
|
||||
/// These settings will apply to the top-level command and all subcommands, by default. Some
|
||||
/// settings can be overridden in subcommands.
|
||||
|
@ -1323,7 +1329,7 @@ impl<'help> App<'help> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Command-specific Settings
|
||||
/// # Command-specific Settings
|
||||
///
|
||||
/// These apply only to the current command and are not inherited by subcommands.
|
||||
impl<'help> App<'help> {
|
||||
|
@ -2173,7 +2179,7 @@ impl<'help> App<'help> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Subcommand-specific Settings
|
||||
/// # Subcommand-specific Settings
|
||||
impl<'help> App<'help> {
|
||||
/// Sets the short version of the subcommand flag without the preceding `-`.
|
||||
///
|
||||
|
@ -3154,7 +3160,7 @@ impl<'help> App<'help> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Reflection
|
||||
/// # Reflection
|
||||
impl<'help> App<'help> {
|
||||
#[inline]
|
||||
pub(crate) fn get_usage_name(&self) -> Option<&str> {
|
||||
|
|
Loading…
Reference in a new issue