Trait arrrg::CommandLine
source · pub trait CommandLine: Sized + Default + Eq + PartialEq {
// Required methods
fn add_opts(&self, prefix: Option<&str>, opts: &mut Options);
fn matches(&mut self, prefix: Option<&str>, matches: &Matches);
fn canonical_command_line(&self, prefix: Option<&str>) -> Vec<String>;
// Provided methods
fn from_command_line(usage: &str) -> (Self, Vec<String>) { ... }
fn from_command_line_relaxed(usage: &str) -> (Self, Vec<String>) { ... }
fn from_arguments(usage: &str, args: &[&str]) -> (Self, Vec<String>) { ... }
fn from_arguments_relaxed(usage: &str, args: &[&str]) -> (Self, Vec<String>) { ... }
fn usage(&mut self, opts: Options, brief: &str) -> ! { ... }
}Expand description
CommandLine creates a command line parser for anyone who implements CommandLine::add_opts, CommandLine::matches and CommandLine::canonical_command_line. This is a wrapper around getopts to tie together options and matches.
Required Methods§
sourcefn add_opts(&self, prefix: Option<&str>, opts: &mut Options)
fn add_opts(&self, prefix: Option<&str>, opts: &mut Options)
Add options to the getopts parser.
sourcefn matches(&mut self, prefix: Option<&str>, matches: &Matches)
fn matches(&mut self, prefix: Option<&str>, matches: &Matches)
Assign values to self using the provided getopts matches.
sourcefn canonical_command_line(&self, prefix: Option<&str>) -> Vec<String>
fn canonical_command_line(&self, prefix: Option<&str>) -> Vec<String>
Return the canonical command line for this CommandLine.
Provided Methods§
sourcefn from_command_line(usage: &str) -> (Self, Vec<String>)
fn from_command_line(usage: &str) -> (Self, Vec<String>)
Parse from the command line. This function will panic if a non-canonical command line is provided.
sourcefn from_command_line_relaxed(usage: &str) -> (Self, Vec<String>)
fn from_command_line_relaxed(usage: &str) -> (Self, Vec<String>)
Parse from the command line. This function will allow a non-canonical command line to execute.
sourcefn from_arguments(usage: &str, args: &[&str]) -> (Self, Vec<String>)
fn from_arguments(usage: &str, args: &[&str]) -> (Self, Vec<String>)
Parse from the provided arguments. This function will panic if a non-canonical command line is provided.