Skip to content

Commit

Permalink
docs(builder): Add ToC to Command, Arg
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Feb 15, 2022
1 parent 94e2727 commit 3dd3993
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 11 deletions.
19 changes: 13 additions & 6 deletions src/build/arg.rs
Expand Up @@ -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
Expand Down Expand Up @@ -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.
///
Expand Down Expand Up @@ -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.
///
Expand Down Expand Up @@ -2727,7 +2734,7 @@ impl<'help> Arg<'help> {
}
}

/// Help
/// # Help
impl<'help> Arg<'help> {
/// Sets the description of the argument for short help (`-h`).
///
Expand Down Expand Up @@ -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.
///
Expand Down Expand Up @@ -4489,7 +4496,7 @@ impl<'help> Arg<'help> {
}
}

/// Reflection
/// # Reflection
impl<'help> Arg<'help> {
/// Get the name of the argument
#[inline]
Expand Down Expand Up @@ -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`")]
Expand Down Expand Up @@ -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() {
Expand Down
16 changes: 11 additions & 5 deletions src/build/command.rs
Expand Up @@ -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
Expand Down Expand Up @@ -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`.
///
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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> {
Expand Down Expand Up @@ -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 `-`.
///
Expand Down Expand Up @@ -3154,7 +3160,7 @@ impl<'help> App<'help> {
}
}

/// Reflection
/// # Reflection
impl<'help> App<'help> {
#[inline]
pub(crate) fn get_usage_name(&self) -> Option<&str> {
Expand Down

0 comments on commit 3dd3993

Please sign in to comment.