pub fn get_item_from_cli_args_or_select<'a, CAS, O, OBA, OF>(
cli_args: &'a [String],
cli_arg_selector: CAS,
items: Vec<O>,
item_find_by_arg: OBA,
) -> Result<Option<O>>Expand description
Returns an item derived from CLI args or asks the user to select one.
Priority order:
- Tries to find the first CLI arg (by predicate) mapping to an existing item via
item_find_by_arg. - Falls back to interactive selection (
minimal_select).
Generic over a collection of displayable, cloneable items, so callers can pass any vector of choices.
§Type Parameters
CASClosure filtering(index, &String)CLI arguments.OBAClosure mapping an argument&strinto a predicate over&O.OFPredicate produced byOBAused to match an item.
§Errors
- A CLI argument matches predicate but no corresponding item is found.
- The interactive selection fails (see
minimal_select).