Skip to content

Commit

Permalink
api: working on adding {before/after}_help_{short/long} to App struct c…
Browse files Browse the repository at this point in the history
  • Loading branch information
Blaxar committed Jul 11, 2020
1 parent 9fc8ec9 commit aa43869
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/build/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ pub struct App<'b> {
pub(crate) about: Option<&'b str>,
pub(crate) long_about: Option<&'b str>,
pub(crate) before_help: Option<&'b str>,
pub(crate) before_help_long: Option<&'b str>,
pub(crate) after_help: Option<&'b str>,
pub(crate) after_help_long: Option<&'b str>,
pub(crate) aliases: Vec<(&'b str, bool)>, // (name, visible)
pub(crate) usage_str: Option<&'b str>,
pub(crate) usage: Option<String>,
Expand Down Expand Up @@ -340,6 +342,25 @@ impl<'b> App<'b> {
self
}

/// Adds additional help information to be displayed in addition to auto-generated help. This
/// information is displayed **after** the auto-generated help information and is meant to be
/// more verbose than `after_help`. This is often used for man pages.. This is often used
/// to describe how to use the arguments, or caveats to be noted in man pages.
///
/// # Examples
///
/// ```no_run
/// # use clap::App;
/// App::new("myprog")
/// .after_help_long("Does really amazing things to great people...but be careful with -R, "
/// "like, for real, be careful with this!")
/// # ;
/// ```
pub fn after_help_long<S: Into<&'b str>>(mut self, help: S) -> Self {
self.after_help_long = Some(help.into());
self
}

/// Adds additional help information to be displayed in addition to auto-generated help. This
/// information is displayed **before** the auto-generated help information. This is often used
/// for header information.
Expand All @@ -357,6 +378,23 @@ impl<'b> App<'b> {
self
}

/// Adds additional help information to be displayed in addition to auto-generated help. This
/// information is displayed **before** the auto-generated help information and is meant to be more
/// verbose than `before_help`. This is often used for header information in man pages.
///
/// # Examples
///
/// ```no_run
/// # use clap::App;
/// App::new("myprog")
/// .before_help_long("Some verbose and long info I'd like to appear before the help info")
/// # ;
/// ```
pub fn before_help_long<S: Into<&'b str>>(mut self, help: S) -> Self {
self.before_help_long = Some(help.into());
self
}

/// Sets a string of the version number to be displayed when displaying version or help
/// information with `-V`.
///
Expand Down

0 comments on commit aa43869

Please sign in to comment.