Trait gumdrop::Options [] [src]

pub trait Options: Sized {
    fn parse<S: AsRef<str>>(parser: &mut Parser<S>) -> Result<Self, Error>;
    fn parse_command<S: AsRef<str>>(
        name: &str,
        parser: &mut Parser<S>
    ) -> Result<Self, Error>; fn usage() -> &'static str; fn command_usage(command: &str) -> Option<&'static str>; fn help_requested(&self) -> bool { ... } fn parse_args<S: AsRef<str>>(
        args: &[S],
        style: ParsingStyle
    ) -> Result<Self, Error> { ... } fn parse_args_default<S: AsRef<str>>(args: &[S]) -> Result<Self, Error> { ... } }

Implements a set of options parsed from command line arguments.

An implementation of this trait can be generated with #[derive(Options)] from the crate gumdrop_derive. Such a derived implementation requires that the type implement the trait Default.

Required Methods

Parses arguments until the given parser is exhausted or until an error is encountered.

Parses options for the named command.

Returns a string showing usage and help for each supported option.

Option descriptions are separated by newlines. The returned string should not end with a newline.

Returns a usage string for the named command.

If the named command does not exist, None is returned.

Command descriptions are separated by newlines. The returned string should not end with a newline.

Provided Methods

Returns whether the user supplied a "help" option to request usage information about the program or any contained subcommands.

The default implementation returns false.

Parses arguments received from the command line.

The first argument (the program name) should be omitted.

Parses arguments received from the command line, using the default parsing style.

The first argument (the program name) should be omitted.

Implementors