Skip to main content

toggle_repo_enabled_for_section_in_file

Function toggle_repo_enabled_for_section_in_file 

Source
pub fn toggle_repo_enabled_for_section_in_file(
    path: &Path,
    section_name: &str,
) -> Result<(), String>
Expand description

What: Toggle enabled for the [[repo]] whose name matches section_name and save the file.

Inputs:

  • path: repos.conf path.
  • section_name: Pacman [repo] name (case-insensitive trim).

Output:

  • Ok(()) or an error (read/parse/write).

Details:

  • When the row is currently enabled (enabled absent or true), sets enabled = false.
  • When currently disabled (enabled = false), clears enabled (treat as enabled again).
  • Requires a validated row with name and results_filter as in load_resolve_repos_from_str.

ยงErrors

  • Read/parse failures, missing matching [[repo]], or write errors surface as Err(String).