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
sourceimpl App
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 RefUnwindSafe for App
impl Send for App
impl Sync for App
impl Unpin for App
impl UnwindSafe for App
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more