Struct combu::command::Command [−][src]
pub struct Command {
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>,
}
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
Implementations
Create new instance of Command with name,authors,version
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(
self,
c: Context,
p: Parser,
inter_mediate_args: VecDeque<MiddleArg>,
last: MiddleArg
) -> Result<ActionResult, ActionError>
pub fn assign_context(
self,
c: Context,
p: Parser,
inter_mediate_args: VecDeque<MiddleArg>,
last: MiddleArg
) -> Result<ActionResult, ActionError>
Assign context to sub command or self own action. コンテキストのargsを見てもサブコマンド行きかコマンドでそのまま処理すればいいか分からなかった時の処理用
pub fn assign_run(
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(
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_sub_result(
self,
req: Result<ActionResult, ActionError>
) -> Result<ActionResult, ActionError>
pub fn handle_sub_result(
self,
req: Result<ActionResult, ActionError>
) -> Result<ActionResult, ActionError>
Handle sub action’s result (Result<ActionResult, ActionError>). Implemented: at ParentActionRequest and Err アクションの結果であるResult<ActionResult, ActionError>をハンドルする関数。現在はParentActionRequestのハンドリング、もしくはエラー表示のみ
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