Trait typeparam::Command
[−]
[src]
pub trait Command where
Self: Sized, { type Error; fn command() -> App<'static, 'static>; fn new(mch: &ArgMatches) -> Result<Self, Self::Error>; fn parse<I: IntoIterator<Item = T>, T: Into<OsString> + Clone>(
itr: I
) -> Result<Self, Error<Self::Error>> { ... } fn parse_args() -> Result<Self, Error<Self::Error>> { ... } fn parse_any<I: IntoIterator<Item = T>, T: Into<OsString> + Clone, E: From<Self::Error> + From<Error>>(
itr: I
) -> Result<Self, E> { ... } fn parse_any_args<E: From<Self::Error> + From<Error>>() -> Result<Self, E> { ... } fn parse_or_exit<I: IntoIterator<Item = T>, T: Into<OsString> + Clone>(
itr: I
) -> Self
where
Self::Error: Display, { ... } fn parse_args_or_exit() -> Self
where
Self::Error: Display, { ... } }
Commands are main result of typeparam!
macro.
Associated Types
type Error
Error that may be returned by the user part of the process.
Required Methods
fn command() -> App<'static, 'static>
Creates an App
based on specified command
fn new(mch: &ArgMatches) -> Result<Self, Self::Error>
Creates structure based on matched arguments.
Provided Methods
fn parse<I: IntoIterator<Item = T>, T: Into<OsString> + Clone>(
itr: I
) -> Result<Self, Error<Self::Error>>
itr: I
) -> Result<Self, Error<Self::Error>>
Starts the automated parsing process with passed iterator.
NOTE --help
and --version
are returned as errors.
NOTE Note that first element of iteration is considered name of binary.
fn parse_args() -> Result<Self, Error<Self::Error>>
Starts the automated parsing process with commandline arguments.
NOTE --help
and --version
are returned as errors.
NOTE Note that command name is considered just a binary name.
fn parse_any<I: IntoIterator<Item = T>, T: Into<OsString> + Clone, E: From<Self::Error> + From<Error>>(
itr: I
) -> Result<Self, E>
itr: I
) -> Result<Self, E>
Starts the automated parsing process with passed iterator.
NOTE --help
and --version
are returned as errors.
NOTE Note that first element of iteration is considered name of binary.
fn parse_any_args<E: From<Self::Error> + From<Error>>() -> Result<Self, E>
Starts the automated parsing process with commandline arguments.
NOTE --help
and --version
are returned as errors.
NOTE Note that command name is considered just a binary name.
fn parse_or_exit<I: IntoIterator<Item = T>, T: Into<OsString> + Clone>(
itr: I
) -> Self where
Self::Error: Display,
itr: I
) -> Self where
Self::Error: Display,
Starts the automated parsing process with passed iterator. If parsing fails an error is printed and process exits.
NOTE Note that command name is considered just a binary name.
fn parse_args_or_exit() -> Self where
Self::Error: Display,
Self::Error: Display,
Starts the automated parsing process with passed iterator. If parsing fails an error is printed and process exits.
NOTE Note that command name is considered just a binary name.