[−][src]Struct seahorse::Context
Context
type
This type is used only for Action
arguments
Fields
args: Vec<String>
Vec<String>
with flags and flag values removed from command line arguments
Implementations
impl Context
[src]
pub fn new(
args: Vec<String>,
flags: Option<Vec<Flag>>,
help_text: String
) -> Self
[src]
args: Vec<String>,
flags: Option<Vec<Flag>>,
help_text: String
) -> Self
Create new instance of Context
Parse processing using Vec<String>
command line argument and Vec<Flag>
as arguments
pub fn bool_flag(&self, name: &str) -> bool
[src]
Get bool flag
Example
use seahorse::Context; fn action(c: &Context) { if c.bool_flag("bool") { println!("True!"); } else { println!("False!"); } }
pub fn string_flag(&self, name: &str) -> Result<String, FlagError>
[src]
Get string flag
Example
use seahorse::Context; fn action(c: &Context) { match c.string_flag("string") { Ok(s) => println!("{}", s), Err(e) => println!("{}", e) } }
pub fn int_flag(&self, name: &str) -> Result<isize, FlagError>
[src]
Get int flag
Example
use seahorse::Context; fn action(c: &Context) { match c.int_flag("int") { Ok(i) => println!("{}", i), Err(e) => println!("{}", e) } }
pub fn float_flag(&self, name: &str) -> Result<f64, FlagError>
[src]
Get float flag
Example
use seahorse::Context; fn action(c: &Context) { match c.float_flag("float") { Ok(f) => println!("{}", f), Err(e) => println!("{}", e) } }
pub fn help(&self)
[src]
Display help
Example
use seahorse::Context; fn action(c: &Context) { c.help(); }
Auto Trait Implementations
impl RefUnwindSafe for Context
impl Send for Context
impl Sync for Context
impl Unpin for Context
impl UnwindSafe for Context
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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.
pub 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>,