[−][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 = &[ Argument::new( &['o'], &["output", "out"], Some("Example output arg"), DataType::Files, ).unwrap(), Argument::new( &['a', 'b', 'c'], &[], Some("Alphabet!"), DataType::None, ).unwrap(), ]; let cli = CliMake::new(args, Some("A showcase CLI to demonstrate climake"), None).unwrap(); println!("Args used: {:#?}", cli.parse()); }
Fields
args: &'cli [Argument<'a>]
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 may use the following snippet (taken from clap) to fetch your cargo version
pub fn crate_version() -> String { format!( "{}.{}.{}{}", env!("CARGO_PKG_VERSION_MAJOR"), env!("CARGO_PKG_VERSION_MINOR"), env!("CARGO_PKG_VERSION_PATCH"), option_env!("CARGO_PKG_VERSION_PRE").unwrap_or("") ) }
Implementations
impl<'cli, 'a> CliMake<'cli, 'a>
[src]
pub fn new(
args: &'cli [Argument<'a>],
description: Option<&'static str>,
version: Option<String>
) -> Result<Self, CLIError>
[src]
args: &'cli [Argument<'a>],
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 parse(&self) -> Vec<UsedArg<'_>>
[src]
Parses arguments and returns all UsedArgs
Trait Implementations
impl<'cli, 'a> Clone for CliMake<'cli, 'a>
[src]
impl<'cli, 'a> Debug for CliMake<'cli, 'a>
[src]
impl<'cli, 'a> PartialEq<CliMake<'cli, 'a>> for CliMake<'cli, 'a>
[src]
fn eq(&self, other: &CliMake<'cli, 'a>) -> bool
[src]
fn ne(&self, other: &CliMake<'cli, 'a>) -> bool
[src]
impl<'cli, 'a> StructuralPartialEq for CliMake<'cli, 'a>
[src]
Auto Trait Implementations
impl<'cli, 'a> RefUnwindSafe for CliMake<'cli, 'a>
impl<'cli, 'a> Send for CliMake<'cli, 'a>
impl<'cli, 'a> Sync for CliMake<'cli, 'a>
impl<'cli, 'a> Unpin for CliMake<'cli, 'a> where
'a: 'cli,
'a: 'cli,
impl<'cli, 'a> UnwindSafe for CliMake<'cli, 'a>
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>,