[][src]Struct argwerk::Help

pub struct Help {
    pub usage: &'static str,
    pub docs: &'static [&'static str],
    pub switches: &'static [Switch],
}

Helper that can be formatted into documentation text.

Fields

usage: &'static str

The verbatim usage summary specified when invoking the macro.

docs: &'static [&'static str]

Documentation comments associated with the command.

switches: &'static [Switch]

Switches associated with the command.

Implementations

impl Help[src]

pub fn format(&self) -> HelpFormat<'_>[src]

Format the help with the given config.

Examples

argwerk::define! {
    /// A simple test command.
    #[usage = "command [-h]"]
    struct Args {
        help: bool,
    }
    /// Prints the help.
    ///
    /// This includes:
    ///    * All the available switches.
    ///    * All the available positional arguments.
    ///    * Whatever else the developer decided to put in here! We even support wrapping comments which are overly long.
    ["-h" | "--help"] => {
        help = true;
    }
}

let formatted = format!("{}", Args::help().format().width(120));

assert!(formatted.split('\n').any(|line| line.len() > 80));
assert!(formatted.split('\n').all(|line| line.len() < 120));

Trait Implementations

impl Display for Help[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.