Struct combu::command::Command [−][src]
pub struct Command {Show 13 fields
pub name: String,
pub action: Option<Action>,
pub authors: String,
pub copyright: String,
pub license: License,
pub description: Option<String>,
pub usage: String,
pub l_flags: Vector<Flag>,
pub c_flags: Vector<Flag>,
pub alias: Vector<String>,
pub version: String,
pub sub: Vector<Command>,
pub help: Option<HelpFunc>,
}
Expand description
The struct for command information store and command execution This can be root and edge コマンドの情報格納&実行用構造体
Fields
name: String
Command name
action: Option<Action>
Command action
Command authors
copyright: String
Command copyright
license: License
License of command
description: Option<String>
Command description
usage: String
Command usage
l_flags: Vector<Flag>
local flags of command
c_flags: Vector<Flag>
common flags of command
alias: Vector<String>
alias for command
version: String
Command version
sub: Vector<Command>
container of sub-command
help: Option<HelpFunc>
custom help fuction
Implementations
Create new instance of Command with name,authors,version
pub fn with_all_field(
name: String,
action: Option<Action>,
authors: String,
copyright: String,
license: License,
description: Option<String>,
usage: String,
local_flags: Vector<Flag>,
common_flags: Vector<Flag>,
alias: Vector<String>,
version: String,
sub: Vector<Command>,
help: Option<HelpFunc>
) -> Command
pub fn with_all_field(
name: String,
action: Option<Action>,
authors: String,
copyright: String,
license: License,
description: Option<String>,
usage: String,
local_flags: Vector<Flag>,
common_flags: Vector<Flag>,
alias: Vector<String>,
version: String,
sub: Vector<Command>,
help: Option<HelpFunc>
) -> Command
Create new instance of Command with more options
Run command with collecting args automatically
Run command as single(do not have sub) command
Set command’s authors
Add a local flag to command
Add a local flags to command
Add a common flag to command
Add a common flag to command
Set command’s description
Add command’s sub command
Add sub commands
Returns true if name_or_alias matches command’s name or one of alias at least name_or_aliasがコマンド名かエイリアスのうち少なくとも一つにマッチした場合trueを返す
Take sub command matches name_or_alias. name_or_aliasに一致するサブコマンドがある場合、保持しているVectorからswap_removeで取り出して返す
Gets sub command mutable reference matches name_or_alias.
Returns init Vector for Context’s route
Run commands with raw_args
Run command with context
pub fn assign_context(
&mut self,
c: Context,
p: Parser,
inter_mediate_args: VecDeque<MiddleArg>,
last: MiddleArg
) -> Result<ActionResult, ActionError>
pub fn assign_context(
&mut self,
c: Context,
p: Parser,
inter_mediate_args: VecDeque<MiddleArg>,
last: MiddleArg
) -> Result<ActionResult, ActionError>
Assign context to sub command or command’s own action. コンテキストのargsを見てもサブコマンド行きかコマンドでそのまま処理すればいいか分からなかった時の処理用
pub fn assign_run(
&mut self,
args: VecDeque<String>,
inter_mediate_args: VecDeque<MiddleArg>,
p: Parser,
raw_args: Vec<String>,
exe_path: String,
last: MiddleArg
) -> Result<ActionResult, ActionError>
pub fn assign_run(
&mut self,
args: VecDeque<String>,
inter_mediate_args: VecDeque<MiddleArg>,
p: Parser,
raw_args: Vec<String>,
exe_path: String,
last: MiddleArg
) -> Result<ActionResult, ActionError>
Assign subcomannd’s run or command’s own action with no context コンテキストが生成されていないときに、run_from_args内で第一引数からサブコマンドかそうでないか分からなかった時に再帰処理を行って割り当てを行う関数
pub fn handle_action_result(
&mut self,
req: Result<ActionResult, ActionError>
) -> Result<ActionResult, ActionError>
pub fn handle_action_result(
&mut self,
req: Result<ActionResult, ActionError>
) -> Result<ActionResult, ActionError>
Handle action’s result (Result<ActionResult, ActionError>). Implemented: show help / show help following show error アクションの結果であるResult<ActionResult, ActionError>をハンドルする関数。現在はhelp表示もしくはエラーを表示したのちのヘルプ表示のみ
Trait Implementations
run function
Auto Trait Implementations
impl RefUnwindSafe for Command
impl UnwindSafe for Command
Blanket Implementations
Mutably borrows from an owned value. Read more