pub struct Program {
pub cmds: Vec<Command>,
pub version: String,
pub author: String,
pub about: String,
}Expand description
The crux of the whole cli, contains a commands field that stores all the program commands in a vector
Fields§
§cmds: Vec<Command>Holds all the possible commands of the program
version: StringContains the version information of the program
Contains the author’s name
about: StringA simple string containing the tagline of the program
Implementations§
Source§impl Program
impl Program
Sourcepub fn init(&mut self)
pub fn init(&mut self)
This function is called when the program starts, it creates all the commands of the program.
pub fn parse(&mut self, args: &Vec<String>) -> Option<Vec<&Command>>
pub fn validate_args(arguments: &Vec<String>, cmds: &Vec<Command>) -> bool
Sourcepub fn output_help(cmds: &Vec<Command>, err: &str)
pub fn output_help(cmds: &Vec<Command>, err: &str)
Outputs help for the program, and prints the error if any is passed
Sourcepub fn output_version()
pub fn output_version()
Simply prints the version information for the program
Sourcepub fn output_command_help(cmd: &Command, err: &str)
pub fn output_command_help(cmd: &Command, err: &str)
Outputs help information for a speficic command and prints an optional error
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Program
impl RefUnwindSafe for Program
impl Send for Program
impl Sync for Program
impl Unpin for Program
impl UnwindSafe for Program
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