pub struct Flag {
pub name: String,
pub description: Option<String>,
pub flag_type: FlagType,
pub alias: Option<Vec<String>>,
}
Expand description
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
sourceimpl Flag
impl Flag
sourcepub fn new<T: Into<String>>(name: T, flag_type: FlagType) -> Self
pub fn new<T: Into<String>>(name: T, flag_type: FlagType) -> Self
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);
sourcepub fn description<T: Into<String>>(self, description: T) -> Self
pub fn description<T: Into<String>>(self, description: T) -> Self
Set description of the flag
Example
use seahorse::{Flag, FlagType};
let bool_flag = Flag::new("bool", FlagType::Bool)
.description("cli cmd Hello --bool");
sourcepub fn alias<T: Into<String>>(self, name: T) -> Self
pub fn alias<T: Into<String>>(self, name: T) -> Self
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");
Trait Implementations
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more