[][src]Struct climake::CliMake

pub struct CliMake {
    pub arguments: Vec<CliArgument>,
    pub help_str: &'static str,
}

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.

Example initiation

This example is not tested
let cli = CliMake.new(
    vec![first_arg, other_arg],
    Some("This is some help info for this example CLI.")
);

Fields

arguments: Vec<CliArgument>

Arguments that this library parses.

help_str: &'static str

Help message that user sees on a --help request or if nothing is passed/bad arguments passed.

Example output

The A simple CLI. in the following terminal output:

Usage: ./readme_showcase [OPTIONS]

About:
  This is some help info for this example CLI.

Options:
  [-q, --qwerty] - Some useful help info.
  [-o, -t, --other] - No extra CLI help provided.

Implementations

impl CliMake[src]

pub fn new(
    arguments: Vec<CliArgument>,
    help: Option<&'static str>
) -> Result<Self, CliError>
[src]

Creates a new CliMake from arguments and optional help.

pub fn parse(&self)[src]

Parses arguments from command line and automatically runs the closures optionally given for CliArgument or displays help infomation.

pub fn add_arg(&mut self, argument: CliArgument) -> Result<(), CliError>[src]

Adds new argument to CliMake

pub fn help_msg(&self) -> String[src]

Returns parsed help message as a String.

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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.