[−][src]Struct seahorse::Command
Application command type
Fields
name: String
Command name
usage: String
Command usage
action: Action
Command action
flags: Option<Vec<Flag>>
Action flags
Methods
impl Command
[src]
pub fn new() -> Self
[src]
Create new instance of Command
Example
use seahorse::Command; let command = Command::new();
pub fn name<T: Into<String>>(self, name: T) -> Self
[src]
Set name of the command
Example
use seahorse::Command; let command = Command::new() .name("cmd");
pub fn usage<T: Into<String>>(self, usage: T) -> Self
[src]
Set usage of the command
Example
use seahorse::Command; let command = Command::new() .usage("cli cmd [arg]");
pub fn action(self, action: Action) -> Self
[src]
Set action of the command
Example
use seahorse::{Command, Context, Action}; let action: Action = |c: &Context| println!("{:?}", c.args); let command = Command::new() .action(action);
pub fn flag(self, flag: Flag) -> Self
[src]
Set flag of the command
Example
use seahorse::{Command, Flag, FlagType}; let command = Command::new() .flag(Flag::new("bool", "cli [arg] --bool", FlagType::Bool)) .flag(Flag::new("int", "cli [arg] --int [int]", FlagType::Int));
pub fn run(&self, v: Vec<String>)
[src]
Run command
Call this function only from App
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Command
impl Send for Command
impl Sync for Command
impl Unpin for Command
impl UnwindSafe for Command
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,