pub struct CmdHandler<'a> { /* private fields */ }
Expand description
Command line parser and subcommand runner
§Example
use subcmd::CmdHandler;
let mut handler = CmdHandler::new();
// Add your custom command here
// handler.add(Box::new(MyCommand));
// handler.add(Box::new(AnotherCommand));
handler.run(); // Run main logic
Implementations§
Source§impl<'a> CmdHandler<'a>
impl<'a> CmdHandler<'a>
Sourcepub fn new() -> CmdHandler<'a>
pub fn new() -> CmdHandler<'a>
Create a new CmdHandler
Sourcepub fn set_description(&mut self, descr: &'a str)
pub fn set_description(&mut self, descr: &'a str)
Set a one line description, used in bin --help
Sourcepub fn get_description(&mut self) -> &'a str
pub fn get_description(&mut self) -> &'a str
Get the program description
Sourcepub fn override_args(&mut self, args: Vec<String>)
pub fn override_args(&mut self, args: Vec<String>)
Override default args
Auto Trait Implementations§
impl<'a> Freeze for CmdHandler<'a>
impl<'a> !RefUnwindSafe for CmdHandler<'a>
impl<'a> !Send for CmdHandler<'a>
impl<'a> !Sync for CmdHandler<'a>
impl<'a> Unpin for CmdHandler<'a>
impl<'a> !UnwindSafe for CmdHandler<'a>
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