Skip to main content

select_command_target

Function select_command_target 

Source
pub fn select_command_target(
    deployment_id: &str,
    targets: &[CommandTarget],
    requested: Option<&str>,
) -> Result<CommandTarget>
Expand description

Target-selection rules shared by both the in-memory and SQLite registries route through.

  • requested = Some(id): the id must be well-formed (no :) and name an existing command-capable target, else COMMAND_TARGET_NOT_FOUND. An empty id never falls back to shorthand.
  • requested = None (single-target shorthand): exactly one target must exist, else COMMAND_TARGET_AMBIGUOUS (more than one) or NO_COMMAND_TARGETS (none).

The resolved target’s own id is also validated, so a target registered with a :-bearing id can never resolve into the key grammar.