Struct ap::App [−][src]
pub struct App<'a> { /* fields omitted */ }The main object used to represent the program.
All consumers of the crate need to create a single object of this type.
Implementations
impl<'a> App<'a>[src]
impl<'a> App<'a>[src]pub fn new(name: &str) -> Self[src]
Create a new application object.
pub fn args(self, args: Args) -> Self[src]
Specify a set of argument handlers to parse the command-line with.
pub fn version(self, version: &str) -> Self[src]
Specify the version of the program.
pub fn summary(self, summary: &str) -> Self[src]
Specify brief explanatory text for the program.
pub fn help(self, help: &str) -> Self[src]
Specify extended usage information for the program.
pub fn notes(self, notes: &str) -> Self[src]
Specify notes for the program.
pub fn settings(self, settings: Settings) -> Self[src]
Specify any settings for the program.
pub fn ignore_unknown_options(self) -> Self[src]
If set, don’t error if unknown options are specified - just ignore them.
Note
This is an alternative to calling the settings() method.
pub fn ignore_unknown_posn_args(self) -> Self[src]
If set, don’t error if unknown positional arguments are specified - just ignore them.
Note
This is an alternative to calling the settings() method.
pub fn generate_help(&self) -> Result<()>[src]
Generate a help/usage statement from the registered Arg’s.
This is called automatically when the user specifies -h anywhere
on the command line; you do not need to register an Arg for -h.
pub fn parse_with_args(&mut self, cli_args: Vec<String>) -> Result<()>[src]
Parse a set of command line arguments (without the program name).
Arguments
cli_args: Vector of string arguments. Specify your own, or call get_args().
Notes
- The
cli_argsvector must not specify the command name (which by default is returned as the first element byenv::args().collect()for example. Use get_args() as this handles this for you.
pub fn handler(self, boxed_handler: Box<dyn Handler + 'a>) -> Self[src]
Specify the handler for the option which must implement the Handler trait.
Note
If the handler needs to modify its own state when called, the specified boxed trait must provide a mutable reference.
pub fn parse(&mut self) -> Result<()>[src]
Simplest interface to the parser.
Trait Implementations
impl<'a> StructuralPartialEq for App<'a>[src]
impl<'a> StructuralPartialEq for App<'a>[src]Auto Trait Implementations
impl<'a> !RefUnwindSafe for App<'a>
impl<'a> !RefUnwindSafe for App<'a>impl<'a> !UnwindSafe for App<'a>
impl<'a> !UnwindSafe for App<'a>