Struct CLI

Source
pub struct CLI<'a> {
    pub name: Option<&'a str>,
    pub version: Option<&'a str>,
    pub description: Option<&'a str>,
    pub options: Vec<Opt<'a>>,
    pub args: Vec<Arg<'a>>,
}

Fields§

§name: Option<&'a str>§version: Option<&'a str>§description: Option<&'a str>§options: Vec<Opt<'a>>§args: Vec<Arg<'a>>

Implementations§

Source§

impl<'a> CLI<'a>

Source

pub fn new() -> Self

Source

pub fn name(&mut self, name: &'a str) -> &mut Self

set the name of the app

Source

pub fn version(&mut self, version: &'a str) -> &mut Self

set the app version

Source

pub fn description(&mut self, desc: &'a str) -> &mut Self

set the app description

Source

pub fn arg( &mut self, name: &'a str, manual: &'a str, description: &'a str, ) -> &mut Self

add new arg

Source

pub fn option(&mut self, manual: &'a str, description: &'a str) -> &mut Self

add new option

Source

pub fn parse(&mut self)

Parse the CL arguments

Source

pub fn get(&self, name: &str) -> Option<&[String]>

Get the value of a specific option by name

Trait Implementations§

Source§

impl<'a> Debug for CLI<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for CLI<'a>

§

impl<'a> RefUnwindSafe for CLI<'a>

§

impl<'a> Send for CLI<'a>

§

impl<'a> Sync for CLI<'a>

§

impl<'a> Unpin for CLI<'a>

§

impl<'a> UnwindSafe for CLI<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.