Struct pgetopts::Options [] [src]

pub struct Options { /* fields omitted */ }

A description of the options that a program can handle

Methods

impl Options
[src]

Create a blank set of options

Set the parsing style

Create a generic option group, stating all parameters explicitly

Create a long option that is optional and does not take an argument.

  • short_name - e.g. "h" for a -h option, or "" for none
  • long_name - e.g. "help" for a --help option, or "" for none
  • desc - Description for usage help

Create a long option that can occur more than once and does not take an argument.

  • short_name - e.g. "h" for a -h option, or "" for none
  • long_name - e.g. "help" for a --help option, or "" for none
  • desc - Description for usage help

Create a long option that is optional and takes an optional argument.

  • short_name - e.g. "h" for a -h option, or "" for none
  • long_name - e.g. "help" for a --help option, or "" for none
  • desc - Description for usage help
  • hint - Hint that is used in place of the argument in the usage help, e.g. "FILE" for a -o FILE option

Create a long option that is optional, takes an argument, and may occur multiple times.

  • short_name - e.g. "h" for a -h option, or "" for none
  • long_name - e.g. "help" for a --help option, or "" for none
  • desc - Description for usage help
  • hint - Hint that is used in place of the argument in the usage help, e.g. "FILE" for a -o FILE option

Create a long option that is optional and takes an argument.

  • short_name - e.g. "h" for a -h option, or "" for none
  • long_name - e.g. "help" for a --help option, or "" for none
  • desc - Description for usage help
  • hint - Hint that is used in place of the argument in the usage help, e.g. "FILE" for a -o FILE option

Create a long option that is required and takes an argument.

  • short_name - e.g. "h" for a -h option, or "" for none
  • long_name - e.g. "help" for a --help option, or "" for none
  • desc - Description for usage help
  • hint - Hint that is used in place of the argument in the usage help, e.g. "FILE" for a -o FILE option

Parse command line arguments according to the provided options.

On success returns Ok(Matches). Use methods such as opt_present opt_str, etc. to interrogate results.

Panics

Returns Err(Fail) on failure: use the Debug implementation of Fail to display information about it.

Derive a short one-line usage summary from a set of long options.

Derive a usage message from a set of long options.