Struct combu::Context[][src]

pub struct Context {
Show fields pub raw_args: Vec<String>, pub args: VecDeque<String>, pub common_flags: Vector<Vector<Flag>>, pub routes: Vector<String>, pub local_flags: Vector<Flag>, pub exe_path: String, pub common_flags_values: Vector<(String, FlagValue)>, pub local_flags_values: Vector<(String, FlagValue)>, pub parsing_args: Option<VecDeque<MiddleArg>>, pub error_info_list: Vector<ErrorInfo>, pub now_cmd_authors: String, pub now_cmd_version: String, pub now_cmd_license: License, pub now_cmd_copyright: String,
}
Expand description

Storage information for command execution. This storage raw args, non-flag args, flag values, and etc. コマンドからrunを通ってactionにたどり着くまでの情報およびパース結果を格納する構造体。 フラグの値、たどってきたルートなどを保管。

Fields

raw_args: Vec<String>

raw args

args: VecDeque<String>

non-flag args

common_flags: Vector<Vector<Flag>>

common_flags of its own and inherited

routes: Vector<String>

routes of from root to end

local_flags: Vector<Flag>

local flags

exe_path: String

exe_path (String, not PathBuf)

common_flags_values: Vector<(String, FlagValue)>

storage of result of parsing common flags values

local_flags_values: Vector<(String, FlagValue)>

storage of result of parsing local flags values

parsing_args: Option<VecDeque<MiddleArg>>

On parsing, storage of parsing args. In edge(action), storage of error args

error_info_list: Vector<ErrorInfo>

error inforamation list of parsing

now_cmd_authors: String

authors

now_cmd_version: String

version

now_cmd_license: License

licence information

now_cmd_copyright: String

copyright

Implementations

Creates a new instance of Context

Creates a new instance of Context with all options.

Set args

Get exe_path as &str

Change exe_path’s value

Find long form of local flag matches name_or_alias ロングフォームがname_or_aliasと一致するローカルフラグを検索してその結果を返す

Find short form of local flag matches name_or_alias ショートフォームがname_or_aliasと一致するローカルフラグを検索してその結果を返す

Find long form of common flag matches name_or_alias ロングフォームがname_or_aliasと一致するコモンフラグを検索してその結果を返す

Find short form of common flag matches name_or_alias ショートフォームがname_or_aliasと一致するコモンフラグを検索してその結果を返す

Add(Push back) middle_arg to this context’s parsing_args

Shift(Push front) middle_arg to this context’s parsing_args

Takes flag value from context. Different from get, returns flag_value instance own (not reference) that has context. contextからフラグ値を取得する。Getとは違い、参照ではなくcontextに格納されているもの(格納されていない場合はデフォルト値のコピー)そのものを返す

Takes inputted flag value from context. Different from get, returns flag_value instance own (not reference) that has context. contextからフラグ値を(ユーザによりargに指定(入力)されている場合)取得する。Getとは違い、参照ではなくcontextに格納されているもの(格納されていない場合はNoneを)そのものを返す

Takes flag value from context. Different from get, returns flag_value instance own (not reference) that has context. contextからローカルフラグの値を取得する。Getとは違い、参照ではなくcontextに格納されているもの(格納されていない場合はデフォルト値のコピー)そのものを返す

Takes inputted flag value from context. Different from get, returns flag_value instance own (not reference) that has context. contextからコモンフラグの値を取得する。Getとは違い、参照ではなくcontextに格納されているもの(格納されていない場合はデフォルト値のコピー)そのものを返す

Takes inputted local flag value from context. Different from get, returns flag_value instance own (not reference) that has context. contextからローカルフラグ値を(ユーザによりargに指定(入力)されている場合)取得する。Getとは違い、参照ではなくcontextに格納されているものそのもの(格納されていない場合はNone)を返す

Takes inputted local flag value from context. Different from get, returns flag_value instance own (not reference) that has context. contextからコモンフラグ値を(ユーザによりargに指定(入力)されている場合)取得する。Getとは違い、参照ではなくcontextに格納されているものそのもの(格納されていない場合はNone)を返す

Gets FlagValue’s clone of the flag matches flag_name from context. contextからフラグ値のcloneを取得する。フラグが設定されていない場合はNoneを返す なお明示的に値が指定されない場合、Bool型のフラグであればFlagValue::Bool(true)とし、String型のフラグであればFlagValue::String(String::new())、それ以外の型のフラグではFlagValue::NoneをSomeで包んで返す

Gets FlagValue’s clone of the inputted flag matches flag_name from context. contextからユーザから指定された場合のフラグ値のcloneを取得する。ユーザから入力されていない場合はNoneを返す。

Gets FlagValue’s clone of the common flag matches flag_name from context. If it is not defined, Returns None. contextからユーザから指定された場合のコモンフラグ値のcloneを取得する。ユーザから入力されていないが定義されている場合はデフォルト値のクローンを返す。定義もされていない場合はNoneを返す。 なお明示的に値が指定されない場合、Bool型のフラグであればFlagValue::Bool(true)とし、String型のフラグであればFlagValue::String(String::new())、それ以外の型のフラグではFlagValue::NoneをSomeで包んで返す

Gets FlagValue’s clone of the common flag matches flag_name from context. If it is not defined, Returns None. contextからユーザから指定された場合のローカルフラグ値のcloneを取得する。ユーザから入力されていないが定義されている場合はデフォルト値のクローンを返す。定義もされていない場合はNoneを返す。 なお明示的に値が指定されない場合、Bool型のフラグであればFlagValue::Bool(true)とし、String型のフラグであればFlagValue::String(String::new())、それ以外の型のフラグではFlagValue::NoneをSomeで包んで返す

Gets the flag value of the local flag matches flag_name if inputted. If it is not defined or not inputted, returns None. flag_nameとnameが一致するローカルフラグがあり、それがユーザからコマンド引数で指定されていた場合、その値のクローンをSomeで包んで返す。flag_nameと一致するnameをどのローカルフラグも持たないか、ユーザがコマンド引数で指定していない場合はNoneを返す。

Gets the flag value of the common flag whose name matches flag_name. If it is not defined or not inputted, returns None. flag_nameとnameが一致するコモンフラグがあり、それがユーザからコマンド引数で指定されていた場合、その値のクローンをSomeで包んで返す。flag_nameと一致するnameをどのコモンフラグも持たないか、ユーザがコマンド引数で指定していない場合はNoneを返す。

Returns flag has specified name is true flag.

Trait Implementations

Formats the value using the given formatter. Read more

Performs the conversion.

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 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.