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

authors: String

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

Creare new instance of Command

Create new instance of Command with name,authors,version

Create new instance of Command with name

Create new instance of Command with more options

Run command with collecting args automatically

Run command as single(do not have sub) command

Show command’s help

Set Command’s name

Set command’s usage

Set command’s action

Set command’s authors

Set command’s copyright

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

Set command’s version

Add command’s sub command

Add sub commands

Sets license

Add command’s alias

Set custom help function

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 true if this command has sub command(s).

Returns init Vector for Context’s route

Run commands with raw_args

Run command with context

Assign context to sub command or command’s own action. コンテキストのargsを見てもサブコマンド行きかコマンドでそのまま処理すればいいか分からなかった時の処理用

Assign subcomannd’s run or command’s own action with no context コンテキストが生成されていないときに、run_from_args内で第一引数からサブコマンドかそうでないか分からなかった時に再帰処理を行って割り当てを行う関数

Handle action’s result (Result<ActionResult, ActionError>). Implemented: show help / show help following show error アクションの結果であるResult<ActionResult, ActionError>をハンドルする関数。現在はhelp表示もしくはエラーを表示したのちのヘルプ表示のみ

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Returns the “default value” for a type. Read more

Performs the conversion.

run function

run function

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.