[−][src]Struct combu::Context
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
current_path: String
current_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
authors
now_cmd_version: String
version
now_cmd_license: Option<(String, String)>
licence information
now_cmd_copyright: String
copyright
Implementations
impl Context
[src]
pub fn new(
raw_args: Vec<String>,
args: VecDeque<String>,
common_flags: Vector<Flag>,
local_flags: Vector<Flag>,
routes: Vector<String>,
current_path: String,
now_cmd_authors: String,
now_cmd_version: String,
now_cmd_copyright: String,
now_cmd_license: Option<(String, String)>
) -> Context
[src]
raw_args: Vec<String>,
args: VecDeque<String>,
common_flags: Vector<Flag>,
local_flags: Vector<Flag>,
routes: Vector<String>,
current_path: String,
now_cmd_authors: String,
now_cmd_version: String,
now_cmd_copyright: String,
now_cmd_license: Option<(String, String)>
) -> Context
Creates a new instance of Context
pub fn build_new(
raw_args: Vec<String>,
args: VecDeque<String>,
common_flags: Vector<Vector<Flag>>,
local_flags: Vector<Flag>,
current_path: String,
routes: Vector<String>,
common_flags_values: Vector<(String, FlagValue)>,
local_flags_values: Vector<(String, FlagValue)>,
parsing_args: Option<VecDeque<MiddleArg>>,
error_info_list: Vector<ErrorInfo>,
now_cmd_authors: String,
now_cmd_version: String,
now_cmd_copyright: String,
now_cmd_license: Option<(String, String)>
) -> Context
[src]
raw_args: Vec<String>,
args: VecDeque<String>,
common_flags: Vector<Vector<Flag>>,
local_flags: Vector<Flag>,
current_path: String,
routes: Vector<String>,
common_flags_values: Vector<(String, FlagValue)>,
local_flags_values: Vector<(String, FlagValue)>,
parsing_args: Option<VecDeque<MiddleArg>>,
error_info_list: Vector<ErrorInfo>,
now_cmd_authors: String,
now_cmd_version: String,
now_cmd_copyright: String,
now_cmd_license: Option<(String, String)>
) -> Context
Creates a new instance of Context with all options.
pub fn args(self, args: VecDeque<String>) -> Self
[src]
Set args
pub fn current(&self) -> &str
[src]
Get current_path as &str
pub fn change_current(self, path: String)
[src]
Change current_path's value
pub fn find_local_long_flag(&self, name_or_alias: &str) -> LongFound<&Flag>
[src]
Find long form of local flag matches name_or_alias ロングフォームがname_or_aliasと一致するローカルフラグを検索してその結果を返す
pub fn find_local_short_flag(&self, short_alias: &char) -> Option<&Flag>
[src]
Find short form of local flag matches name_or_alias ショートフォームがname_or_aliasと一致するローカルフラグを検索してその結果を返す
pub fn find_common_long_flag(&self, name_or_alias: &str) -> LongFound<&Flag>
[src]
Find long form of common flag matches name_or_alias ロングフォームがname_or_aliasと一致するコモンフラグを検索してその結果を返す
pub fn find_common_short_flag(&self, short_alias: &char) -> Option<&Flag>
[src]
Find short form of common flag matches name_or_alias ショートフォームがname_or_aliasと一致するコモンフラグを検索してその結果を返す
pub fn push_back_to_parsing_args(&mut self, middle_arg: MiddleArg)
[src]
Add(Push back) middle_arg to this context's parsing_args
pub fn take_flag_value_of(&mut self, flag_name: &str) -> Option<FlagValue>
[src]
Takes flag value from context. Different from get, returns flag_value instance own (not reference) that has context. contextからフラグ値を取得する。Getとは違い、参照ではなくcontextに格納されているもの(格納されていない場合はデフォルト値のコピー)そのものを返す
pub fn take_inputted_flag_value_of(
&mut self,
flag_name: &str
) -> Option<FlagValue>
[src]
&mut self,
flag_name: &str
) -> Option<FlagValue>
Takes inputted flag value from context. Different from get, returns flag_value instance own (not reference) that has context. contextからフラグ値を(ユーザによりargに指定(入力)されている場合)取得する。Getとは違い、参照ではなくcontextに格納されているもの(格納されていない場合はNoneを)そのものを返す
pub fn take_local_flag_value_of(&mut self, flag_name: &str) -> Option<FlagValue>
[src]
Takes flag value from context. Different from get, returns flag_value instance own (not reference) that has context. contextからローカルフラグの値を取得する。Getとは違い、参照ではなくcontextに格納されているもの(格納されていない場合はデフォルト値のコピー)そのものを返す
pub fn take_common_flag_value_of(
&mut self,
flag_name: &str
) -> Option<FlagValue>
[src]
&mut self,
flag_name: &str
) -> Option<FlagValue>
Takes inputted flag value from context. Different from get, returns flag_value instance own (not reference) that has context. contextからコモンフラグの値を取得する。Getとは違い、参照ではなくcontextに格納されているもの(格納されていない場合はデフォルト値のコピー)そのものを返す
pub fn take_inputted_local_flag_value_of(
&mut self,
flag_name: &str
) -> Option<FlagValue>
[src]
&mut self,
flag_name: &str
) -> Option<FlagValue>
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)を返す
pub fn take_inputted_common_flag_value_of(
&mut self,
flag_name: &str
) -> Option<FlagValue>
[src]
&mut self,
flag_name: &str
) -> Option<FlagValue>
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)を返す
pub fn get_flag_value_of(&self, flag_name: &str) -> Option<FlagValue>
[src]
Gets FlagValue's clone of the flag matches flag_name from context. contextからフラグ値のcloneを取得する。フラグが設定されていない場合はNoneを返す
pub fn get_inputted_flag_value_of(&self, flag_name: &str) -> Option<FlagValue>
[src]
Gets FlagValue's clone of the inputted flag matches flag_name from context. contextからユーザから指定された場合のフラグ値のcloneを取得する。ユーザから入力されていない場合はNoneを返す。
pub fn get_common_flag_value_of(&self, flag_name: &str) -> Option<FlagValue>
[src]
Gets FlagValue's clone of the common flag matches flag_name from context. If it is not defined, Returns None. contextからユーザから指定された場合のコモンフラグ値のcloneを取得する。ユーザから入力されていないが定義されている場合はデフォルト値のクローンを返す。定義もされていない場合はNoneを返す。
pub fn get_local_flag_value_of(&self, flag_name: &str) -> Option<FlagValue>
[src]
Gets FlagValue's clone of the common flag matches flag_name from context. If it is not defined, Returns None. contextからユーザから指定された場合のローカルフラグ値のcloneを取得する。ユーザから入力されていないが定義されている場合はデフォルト値のクローンを返す。定義もされていない場合はNoneを返す。
pub fn get_inputted_local_flag_value_of(
&self,
flag_name: &str
) -> Option<FlagValue>
[src]
&self,
flag_name: &str
) -> Option<FlagValue>
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を返す。
pub fn get_inputted_common_flag_value_of(
&self,
flag_name: &str
) -> Option<FlagValue>
[src]
&self,
flag_name: &str
) -> Option<FlagValue>
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を返す。
pub fn is_flag_true(&self, name: &str) -> bool
[src]
Returns flag has specified name is true flag.
Trait Implementations
impl Debug for Context
[src]
impl<'a> From<Vec<String>> for Context
[src]
impl Run<Context> for Command
[src]
fn run(&mut self, c: Context) -> Result<ActionResult, ActionError>
[src]
Auto Trait Implementations
impl RefUnwindSafe for Context
impl Send for Context
impl Sync for Context
impl Unpin for Context
impl UnwindSafe for Context
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,
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.
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>,