pub struct App {
pub name: String,
pub version: String,
pub author: String,
pub args: HashMap<String, Vec<String>>,
}
Expand description
A public struct for your awesome CLI app!
Fields§
§name: String
§version: String
§args: HashMap<String, Vec<String>>
Implementations§
Source§impl App
Implementing all methods for
your app that give you the freedom
to choose what you’d like to do.
impl App
Implementing all methods for your app that give you the freedom to choose what you’d like to do.
Sourcepub fn new(name: String, version: String, author: String) -> App
pub fn new(name: String, version: String, author: String) -> App
Instantiates the “App” struct.
Sourcepub fn arg_was_used(&self, arg: String) -> bool
pub fn arg_was_used(&self, arg: String) -> bool
Checks if “-a” or “–arg” was used.
Sourcepub fn add_arg(&mut self, name: String, help: String, data: String)
pub fn add_arg(&mut self, name: String, help: String, data: String)
Adds an argument to the argument pool. If you’d like to accept data for an argument, set the “data” flag to either “true” or “false”.
Sourcepub fn get_arg_data(&self, name: String) -> String
pub fn get_arg_data(&self, name: String) -> String
Retrieves the command line data for an argument.
Sourcepub fn version_is(&self) -> bool
pub fn version_is(&self) -> bool
Returns a boolean to tell you whether version info was requested or not.
Sourcepub fn help_is(&self) -> bool
pub fn help_is(&self) -> bool
Returns a boolean to tell you whether help info was requested or not.
Auto Trait Implementations§
impl Freeze for App
impl RefUnwindSafe for App
impl Send for App
impl Sync for App
impl Unpin for App
impl UnwindSafe for App
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