pub struct CliOptionParser { /* private fields */ }Expand description
A parser for CLI options and arguments.
This struct allows registering options with short and long forms, parsing command-line arguments, and retrieving the values of options or normal arguments.
Implementations§
Source§impl CliOptionParser
impl CliOptionParser
Sourcepub fn new(header: String, footer: String) -> CliOptionParser
pub fn new(header: String, footer: String) -> CliOptionParser
Creates a new CliOptionParser instance with the given header and footer text.
Sourcepub fn parse(&mut self) -> Vec<String>
pub fn parse(&mut self) -> Vec<String>
Parses the command-line arguments and returns the list of normal arguments.
Sourcepub fn is_enabled(&self, name: &str) -> bool
pub fn is_enabled(&self, name: &str) -> bool
Checks if the option with the given name is enabled.
Sourcepub fn get_option_values(&self, name: &str) -> &Vec<String>
pub fn get_option_values(&self, name: &str) -> &Vec<String>
Returns the values associated with the option name, or an empty list if not enabled.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CliOptionParser
impl RefUnwindSafe for CliOptionParser
impl Send for CliOptionParser
impl Sync for CliOptionParser
impl Unpin for CliOptionParser
impl UnsafeUnpin for CliOptionParser
impl UnwindSafe for CliOptionParser
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