[−][src]Struct kern::Command
Command represents an command parsed from the command-line
Example
extern crate kern; use kern::Command; use std::env; let args: Vec<String> = env::args().collect(); let command = Command::from(&args, &["option"]);
Methods
impl<'a> Command<'a>
[src]
pub fn get_command(&self) -> &'a str
[src]
Get command name
pub fn get_parameters(&self) -> &BTreeMap<&'a str, &'a str>
[src]
Get all parameters
pub fn get_parameter(&self, name: &'a str) -> Option<&&'a str>
[src]
Get specific parameter
pub fn get_options(&self) -> &Vec<&'a str>
[src]
Get all options
pub fn is_option(&self, name: &'a str) -> bool
[src]
Check if option provided
pub fn get_arguments(&self) -> &Vec<&'a str>
[src]
Get all arguments
pub fn get_argument(&self, index: usize) -> Option<&&'a str>
[src]
Get argument at specific index
pub fn without_options(raw: &'a [String]) -> Self
[src]
Create a new Command from raw command line arguments without options Provide the arguments list as &[&str]
extern crate kern; use kern::Command; use std::env; let args: Vec<String> = env::args().collect(); let command = Command::without_options(&args);
pub fn from(raw: &'a [String], filter_options: &[&str]) -> Self
[src]
Create a new Command from raw command line arguments Provide the arguments list as &[&str]
extern crate kern; use kern::Command; use std::env; let args: Vec<String> = env::args().collect(); let command = Command::from(&args, &["option"]);
Trait Implementations
impl<'a> Clone for Command<'a>
[src]
fn clone(&self) -> Command<'a>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<'a> Debug for Command<'a>
[src]
Auto Trait Implementations
impl<'a> Sync for Command<'a>
impl<'a> Unpin for Command<'a>
impl<'a> Send for Command<'a>
impl<'a> UnwindSafe for Command<'a>
impl<'a> RefUnwindSafe for Command<'a>
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,