[][src]Struct seahorse::Flag

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

Flag type.

Option flag struct

Fields

name: String

Flag name

usage: String

Flag usage

flag_type: FlagType

Flag type

alias: Option<Vec<String>>

Flag alias

Methods

impl Flag[src]

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

Create new instance of Flag

Example

use seahorse::{Flag, FlagType};

let bool_flag = Flag::new("bool", "cli cmd [arg] --bool", FlagType::Bool);
let float_flag = Flag::new("float", "cli cmd [arg] --float [float]", FlagType::Float);

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", "cli cmd [arg] --bool", FlagType::Bool)
    .alias("b");

let string_flag = Flag::new("string", "cli cmd [arg] --string [string]", FlagType::String)
    .alias("s")
    .alias("str");

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

Get flag value

Trait Implementations

impl Clone 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.