Skip to main content

select_context

Function select_context 

Source
pub fn select_context(
    available: &[String],
    requested: Option<&str>,
) -> Result<String, SelectError>
Expand description

Pick the worker dir to serve. Pure (the FS scan is done by the caller) so the select-or-default rule (D3) is unit-tested directly.

available are worker directory names (dots already dasherised, e.g. commerce-payment). A requested --context matches either the raw name or its dasherised form, so both --context commerce.payment and --context commerce-payment resolve.