Struct lapp::Args

source ·
pub struct Args<'a> { /* private fields */ }

Implementations

provide a usage string from which we extract flag definitions

start offset in program command-line arguments. This defaults to 1, but e.g. for Cargo subcommands it would be 2

declare any user-defined types to be used in the spec. (They will need to implement FromStr)

bail out of program with non-zero return code. May force this to panic instead with the LAPP_PANIC environment variable.

create suggested variable or struct declarations for accessing the flags…

parse the spec and the command-line

parse the spec and the command-line, quitting on error.

parse the spec and create the flags.

clear used flag state

clear all the flags - ready to parse a new command line.

has this flag been set? Quits if it’s an unknown flag

get flag as a string

get flag as an integer

get flag as a float

get flag as boolean

get flag as a file for reading

get flag as a file for writing

get flag as a path

get flag always as text, if it’s defined

get flag as any value which can parsed from a string.

get flag as a string, quitting otherwise.

get flag as an integer, quitting otherwise.

get flag as a float, quitting otherwise.

get flag as a bool, quitting otherwise.

get flag as a file for reading, quitting otherwise.

get flag as a file for writing, quitting otherwise.

get flag as a path, quitting otherwise.

get flag as any value which can parsed from a string, quitting otherwise.

get a multiple flag as an array of strings

get a multiple flag as an array of integers

get a multiple flag as an array of floats

get a multiple flag as an array of any parsable value.

get a multiple flag as an array of strings, quitting otherwise

get a multiple flag as an array of integers, quitting otherwise

get a multiple flag as an array of floats, quitting otherwise

get a multiple flag as an array of any parsable value, quitting otherwise

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.