How to see the repository URIs with DNF's repolist subcommand?

@Alessio, thanks. Lots.

That was really interesting - I didn’t consider also getting valid INI data at the same time. I’ve used your basis to generate some code to do so, though: [1]

  1. #!/usr/bin/env bash
    dnf --dump-repo-config=* | awk '
        BEGIN { max_key_length = 0 }
        /===/ {
            match($0, /"([^"]+)"/, arr);
            if (arr[1]) {
                repo = arr[1];
                max_key_length = (length("repo") > max_key_length) ? length("repo") : max_key_length;
            }
            next;
        }
        /^enabled =/ {
            match($0, /(enabled = )(.*)/, arr);
            if (arr[2]) {
                enabled = arr[2];
                max_key_length = (length("enabled") > max_key_length) ? length("enabled") : max_key_length;
            }
            next;
        }
        /^metalink/ {
            match($0, /(metalink = )(.*)/, arr);
            if (arr[2]) {
                metalink = arr[2];
                max_key_length = (length("metalink") > max_key_length) ? length("metalink") : max_key_length;
            }
            # Print all the aligned lines after capturing the current block
            printf "%-*s = \"%s\"\n", max_key_length, "repo", repo;
            printf "%-*s = %s\n", max_key_length, "enabled", enabled;
            printf "%-*s = \"%s\"\n", max_key_length, "metalink", metalink;
        }
    '
    
    
  2. repo     = "updates-testing-debuginfo"
    enabled  = 0
    metalink = "https://mirrors.fedoraproject.org/metalink?repo=updates-testing-debug-f41&arch=x86_64"
    

  1. chatgpt.com/share/6758acd6-1660-8006-8dee-f154fc5f2f2b ↩︎