mafw.devtools.toolchain.filtering
Tool filtering utility for the toolchain command group.
This module provides resolve_tools(), a shared function used by all CLI
subcommands to determine which tools to process based on the --include-host,
-i/--include, and -e/--exclude options. It enforces mutual
exclusivity between include and exclude filters, warns on unrecognized tool
names, and preserves the original registration order from the registry.
Functions
|
Filter the registry based on CLI options. |
- mafw.devtools.toolchain.filtering.resolve_tools(registry: ToolRegistry, *, include: tuple[str, ...] = (), exclude: tuple[str, ...] = (), include_host: bool = False) list[ToolChainTool][source]
Filter the registry based on CLI options.
The filtering pipeline proceeds in order:
Reject mutually exclusive
includeandexcludearguments.Start with all tools from the registry (preserving insertion order).
If include_host is
False, remove tools with category"host".If include is non-empty, keep only tools whose name is in the set (emit a warning for each unrecognized name).
If exclude is non-empty, remove tools whose name is in the set (emit a warning for each unrecognized name).
- Parameters:
registry – The central tool registry to query.
include – Tool names to include exclusively. Only tools whose
namematches one of these values will be returned.exclude – Tool names to exclude. Tools whose
namematches one of these values will be removed from the result.include_host – When
False(the default), tools withcategory="host"are excluded before any name-based filtering.
- Returns:
A list of tools in their original registration order.
- Raises:
DevtoolsError – If both include and exclude are non-empty (mutual exclusivity violation).