[][src]Function menu::argument_finder

pub fn argument_finder<'a, T>(
    item: &'a Item<'a, T>,
    argument_list: &'a [&'a str],
    name_to_find: &'a str
) -> Result<Option<&'a str>, ()>

Looks for the named parameter in the parameter list of the item, then finds the correct argument.

  • Returns Ok(None) if parameter_name gives an optional or named parameter and that argument was not given.
  • Returns Ok(arg) if the argument corresponding to parameter_name was found. arg is the empty string if the parameter was Parameter::Named (and hence doesn't take a value).
  • Returns Err(()) if parameter_name was not in item.parameter_list or item wasn't an Item::Callback