App

Struct App 

Source
pub struct App<'a> { /* private fields */ }
Expand description

Xcli object

Implementations§

Source§

impl<'a> App<'a>

Source

pub fn new<S: Into<String>>(n: S) -> Self

Create a new cli instance and return it

Source

pub fn get_name(&self) -> &str

Get the name of this instance

Source

pub fn get_author(&self) -> &str

Get the author of this instance

Source

pub fn get_version(&self) -> &str

Get the version of this instance

Source

pub fn author<S: Into<&'a str>>(self, author: S) -> Self

Set the author of this instance

Source

pub fn version<S: Into<&'a str>>(self, ver: S) -> Self

Get the version of this instance.

Source

pub fn add_subcommand(&mut self, subcmd: Command<'a>)

Add sub commands to command tree.

Source

pub fn add_subcommand_with_userdata( &mut self, subcmd: Command<'a>, value: Box<dyn Any>, )

Add sub commands to commands, with user defined data.

userdata must be an IAny trait object, which will be associated with the command name of the subcmd.

Source

pub fn show_tree(&self)

Show all commands and their subcommands like a tree

Source

pub fn get_handler<S: Into<String>>( &self, key: S, ) -> stdResult<&Box<dyn Any>, XcliError>

Get handler

Source

pub fn run(self)

Run the instance

Auto Trait Implementations§

§

impl<'a> Freeze for App<'a>

§

impl<'a> !RefUnwindSafe for App<'a>

§

impl<'a> !Send for App<'a>

§

impl<'a> !Sync for App<'a>

§

impl<'a> Unpin for App<'a>

§

impl<'a> !UnwindSafe for App<'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.