Struct seahorse::Flag[][src]

pub struct Flag {
    pub name: String,
    pub description: Option<String>,
    pub flag_type: FlagType,
    pub alias: Option<Vec<String>>,
}

Flag type.

Option flag struct

Fields

name: String

Flag name

description: Option<String>

Flag description

flag_type: FlagType

Flag type

alias: Option<Vec<String>>

Flag alias

Implementations

impl Flag[src]

pub fn new<T: Into<String>>(name: T, flag_type: FlagType) -> Self[src]

Create new instance of Flag

Example

use seahorse::{Flag, FlagType};

let bool_flag = Flag::new("bool", FlagType::Bool);
let float_flag = Flag::new("float", FlagType::Float);

pub fn description<T: Into<String>>(self, description: T) -> Self[src]

Set description of the flag

Example

use seahorse::{Flag, FlagType};

let bool_flag = Flag::new("bool", FlagType::Bool)
    .description("cli cmd Hello --bool");

pub fn alias<T: Into<String>>(self, name: T) -> Self[src]

Set alias of the flag

Example

use seahorse::{Flag, FlagType};

let bool_flag = Flag::new("bool", FlagType::Bool)
    .alias("b");

let string_flag = Flag::new("string", FlagType::String)
    .alias("s")
    .alias("str");

pub fn option_index(&self, v: &[String]) -> Option<usize>[src]

Get flag position from command line argument

pub fn value(&self, v: Option<String>) -> Result<FlagValue, FlagError>[src]

Get flag value

Trait Implementations

impl Clone for Flag[src]

impl Debug for Flag[src]

Auto Trait Implementations

impl RefUnwindSafe for Flag

impl Send for Flag

impl Sync for Flag

impl Unpin for Flag

impl UnwindSafe for Flag

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.