pub struct Flag { /* private fields */ }Expand description
Flag
Implementations§
Source§impl Flag
impl Flag
Sourcepub fn get_value(&self) -> Option<String>
pub fn get_value(&self) -> Option<String>
Get flag value
Examples found in repository?
examples/ecla.rs (line 43)
35fn main() {
36 let app = App::new(HELP, VERSION);
37
38 if let Some(_) = app.get_command("command") {
39 command();
40 } else if let Some(command) = app.get_command("flag") {
41 let flag = command.get_flag(&["-f", "--force"]);
42 if flag.is_some() {
43 command_with_flag(flag.unwrap().get_value());
44 } else {
45 command_with_no_flag();
46 }
47 } else if let Some(command) = app.get_command("value") {
48 command_with_value(command.get_value());
49 } else {
50 app.show_unknown_or_help();
51 }
52}Trait Implementations§
Auto Trait Implementations§
impl Freeze for Flag
impl RefUnwindSafe for Flag
impl Send for Flag
impl Sync for Flag
impl Unpin for Flag
impl UnwindSafe for Flag
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more