Struct clargs::Parser [] [src]

pub struct Parser { /* fields omitted */ }

Object used to parse command-line arguments.

Holds information required to parse arguments and has methods to access this information.

Methods

impl Parser
[src]

[src]

Constructs and returns a new Parser object.

[src]

Returns true if the specified name is a valid option name. An option's name can only contain lower and uppercase letters and hyphens.

[src]

Returns true if the Parser currently has an option or an alias with the specified name.

[src]

Invalidates any option with the specified name from the Parser object. Does nothing if there is no such option.

If an option is removed, all aliases to that option will be removed aswell. If an alias is removed, only that alias will be removed and nothing else.

[src]

Registers a new flag with the Parser under the specified name.

Panics

Panics if there already is an option or an alias with the specified name. Or if the specified name is an invalid option name.

[src]

Registers a new named parameter with the Parser under the specified name. The named parameter's associated type is set to the T type.

Panics

Panics if there already is an option or an alias with the specified name. Or if the specified name is an invalid option name.

[src]

Registers a new alias with the Parser with the specified name to the specified target.

Panics

Panics if there already is an option or an alias with the specified name. Or if the specified name is an invalid option name. Or if the specified target is not a present option.

[src]

Returns true if the double-hyphen marker is enabled.

[src]

Enables the double-hyphen marker.

[src]

Disables the double-hyphen marker.

[src]

Matches the specified partial option name to the options registered with the Parser. A partial matches an option if that option's name starts with partial. Matches are returned as a sorted vector of strings containing the options's names.

If an exact match occurs, only that option will be returned and all other matches are discarded.

[src]

Returns the definite name of an option. If the specified name is an alias, returns the name of the option it points to. Otherwise, returns the same string.

[src]

Parses the specified command-line arguments. If an error occurred according to the Parser's configuration, a ParsingError will be returned. Otherwise, a ParsingResults object will be returned containing the results.

Trait Implementations

impl Default for Parser
[src]

[src]

Returns the "default value" for a type. Read more