Struct hyper_scripter::args::Tags
source · Fields§
§subcmd: Option<TagsSubs>Implementations§
source§impl Tags
impl Tags
sourcepub fn sanitize(&mut self)
pub fn sanitize(&mut self)
Examples found in repository?
src/args/mod.rs (line 441)
428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461
pub fn sanitize(&mut self) -> Result {
match &mut self.subcmd {
Some(Subs::Other(args)) => {
let args = [APP_NAME, "run"]
.into_iter()
.chain(args.iter().map(|s| s.as_str()));
self.subcmd = Some(Subs::parse_from(args));
log::info!("執行模式 {:?}", self.subcmd);
}
Some(Subs::Help { args }) => {
print_help(args.iter())?;
}
Some(Subs::Tags(tags)) => {
tags.sanitize();
}
Some(Subs::Types(types)) => {
types.sanitize();
}
None => {
log::info!("無參數模式");
self.subcmd = Some(Subs::Edit {
edit_query: EditQuery::Query(Default::default()),
ty: None,
content: vec![],
tags: None,
fast: false,
no_template: false,
});
}
_ => (),
}
self.sanitize_flags();
Ok(())
}Trait Implementations§
source§impl CommandFactory for Tags
impl CommandFactory for Tags
source§fn into_app_for_update<'b>() -> Command<'b>
fn into_app_for_update<'b>() -> Command<'b>
Deprecated, replaced with
CommandFactory::command_for_updatesource§impl FromArgMatches for Tags
impl FromArgMatches for Tags
source§fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
source§fn from_arg_matches_mut(
__clap_arg_matches: &mut ArgMatches
) -> Result<Self, Error>
fn from_arg_matches_mut(
__clap_arg_matches: &mut ArgMatches
) -> Result<Self, Error>
source§fn update_from_arg_matches(
&mut self,
__clap_arg_matches: &ArgMatches
) -> Result<(), Error>
fn update_from_arg_matches(
&mut self,
__clap_arg_matches: &ArgMatches
) -> Result<(), Error>
Assign values from
ArgMatches to self.source§fn update_from_arg_matches_mut(
&mut self,
__clap_arg_matches: &mut ArgMatches
) -> Result<(), Error>
fn update_from_arg_matches_mut(
&mut self,
__clap_arg_matches: &mut ArgMatches
) -> Result<(), Error>
Assign values from
ArgMatches to self.source§impl Parser for Tags
impl Parser for Tags
source§fn parse_from<I, T>(itr: I) -> Selfwhere
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
fn parse_from<I, T>(itr: I) -> Selfwhere
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
Parse from iterator, exit on error
source§fn try_parse_from<I, T>(itr: I) -> Result<Self, Error>where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
fn try_parse_from<I, T>(itr: I) -> Result<Self, Error>where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
Parse from iterator, return Err on error.
source§fn update_from<I, T>(&mut self, itr: I)where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
fn update_from<I, T>(&mut self, itr: I)where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
Update from iterator, exit on error
source§fn try_update_from<I, T>(&mut self, itr: I) -> Result<(), Error>where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
fn try_update_from<I, T>(&mut self, itr: I) -> Result<(), Error>where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
Update from iterator, return Err on error.