[−][src]Struct climake::CLIMake
Main holder structure of entire climake library, used to create new CLIs.
It is reccomended this be called something simple like cli
for ease of use
as this is the most used part of climake.
Examples
use climake::{Argument, CLIMake, DataType}; fn main() { let args = vec![ Argument::new( vec!['o'], vec![String::from("output"), String::from("out")], Some("Example output arg"), DataType::File, ).unwrap(), Argument::new( vec!['a', 'b', 'c'], vec![], Some("Alphabet!"), DataType::None, ).unwrap(), ]; let cli = CLIMake::new(args, Some("A showcase CLI to demonstrate climake"), None).unwrap(); println!("Args used:\n{:#?}", cli.parse()); }
Fields
args: Vec<Argument>
Arguments to use for CLI instance
description: Option<&'static str>
Optional description of CLI
version: Option<String>
Optional version of CLI/program
Finding your crate's version
You can use the following snippet to find out your crates version:
#[macro_export] macro_rules! crate_version { () => { format!("{}.{}.{}{}", env!("CARGO_PKG_VERSION_MAJOR"), env!("CARGO_PKG_VERSION_MINOR"), env!("CARGO_PKG_VERSION_PATCH"), option_env!("CARGO_PKG_VERSION_PRE").unwrap_or("")) } }
Taken from clap's crate_version
Implementations
impl CLIMake
[src]
pub fn new(
args: Vec<Argument>,
description: Option<&'static str>,
version: Option<String>
) -> Result<Self, CLIError>
[src]
args: Vec<Argument>,
description: Option<&'static str>,
version: Option<String>
) -> Result<Self, CLIError>
Shortcut to making a CLIMake structure, the main entrypoint into building a CLI with climake
pub fn header_msg(&self) -> String
[src]
Header message to be used above help or errors to show the CLI has been at least successfully initiated and to show basic info about the program
pub fn help_msg(&self) -> String
[src]
Overall help for built CLI, displays header and every arg using Argument::pretty_help
pub fn specific_help(&self, arg: &Argument) -> String
[src]
Produces a Argument::pretty_help with CLI's header to be used for arg-specific help messages
pub fn add_arg(&mut self, arg: Argument) -> Result<(), CLIError>
[src]
Adds new argument to instanced cli
pub fn parse(&self) -> Vec<UsedArg>
[src]
Parses arguments and returns all UsedArgs
Trait Implementations
impl Clone for CLIMake
[src]
impl Debug for CLIMake
[src]
impl PartialEq<CLIMake> for CLIMake
[src]
impl StructuralPartialEq for CLIMake
[src]
Auto Trait Implementations
impl RefUnwindSafe for CLIMake
impl Send for CLIMake
impl Sync for CLIMake
impl Unpin for CLIMake
impl UnwindSafe for CLIMake
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,