Struct seahorse::Command [−][src]
Application command type
Fields
name: String
Command name
description: Option<String>
Command description
usage: Option<String>
Command usage
action: Option<Action>
Command action
flags: Option<Vec<Flag>>
Action flags
alias: Option<Vec<String>>
Command alias
Implementations
impl Command
[src]
pub fn new<T: Into<String>>(name: T) -> Self
[src]
Create new instance of Command
Example
use seahorse::Command; let command = Command::new("cmd");
pub fn description<T: Into<String>>(self, description: T) -> Self
[src]
Set description of the command
Example
use seahorse::Command; let command = Command::new("cmd") .description("cli sub command");
pub fn usage<T: Into<String>>(self, usage: T) -> Self
[src]
Set usage of the command
Example
use seahorse::Command; let command = Command::new("cmd") .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("cmd") .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("cmd") .flag(Flag::new("bool", FlagType::Bool)) .flag(Flag::new("int", FlagType::Int));
pub fn alias<T: Into<String>>(self, name: T) -> Self
[src]
Set alias of the command
Example
use seahorse::Command; let command = Command::new("cmd") .alias("c");
pub fn run(&self, args: 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,
pub 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.
pub 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>,