pub fn validate_package_names<S: AsRef<str>>(
names: &[S],
context: &str,
) -> Result<()>Expand description
What: Validate a list of package names against the strict install-command allowlist.
Inputs:
names: Package names that will be placed into commands.context: Human-readable operation context for actionable error messages.
Output:
Ok(())when all names are valid.Err(ArchToolkitError::InvalidPackageName)naming the first invalid package.
Details:
- Centralises validation so all install builders apply the same safety policy.
- The reported pattern states the leading-byte restriction that prevents option confusion.
- Ported from Pacsea’s
install/utils.rs, adapted toArchToolkitError.
§Errors
Returns ArchToolkitError::InvalidPackageName for the first name that fails
is_safe_package_name().