--- repology.d.orig 2025-02-11 04:00:24.000000000 +0200 +++ repology.d 2026-05-01 15:47:06.450022291 +0300 @@ -68,44 +68,43 @@ break; } } - if (!options.repo) - stderr.writeln("repology: specify your repo with the --repo flag"); } else version (linux) { import std.file; import std.string; string distro, release; - string[] lines = splitLines(cast(string)read("/etc/os-release")); - foreach (line; lines) { - if (line.startsWith("ID=")) { - auto id = line.split("="); - distro = id[1].idup; - } else if (line.startsWith("VERSION_ID=")) { - auto versionid = line.split("="); - release = versionid[1].idup; + try { + string[] lines = splitLines(cast(string)read("/etc/os-release")); + foreach (line; lines) { + if (line.startsWith("ID=")) { + auto id = line.split("="); + distro = id[1].idup; + } else if (line.startsWith("VERSION_ID=")) { + auto versionid = line.split("="); + release = versionid[1].idup; + } } - } - switch (distro) { - case "alpine": - options.repo = distro ~ "_edge"; - break; - case "debian": - options.repo = distro ~ "_unstable"; - break; - case "fedora": - options.repo = distro ~ "_rawhide"; - break; - case "gentoo": - options.repo = distro; - break; - case "ubuntu": - options.repo = distro ~ "_" ~ - release.strip("\"").replaceFirst(".", "_"); - break; - default: - stderr.writeln("repology: specify your repo with the --repo flag"); - } - } else { - stderr.writeln("repology: specify your repo with the --repo flag"); + final switch (distro) { + case "alpine": + options.repo = distro ~ "_edge"; + break; + case "debian": + options.repo = distro ~ "_unstable"; + break; + case "fedora": + options.repo = distro ~ "_rawhide"; + break; + case "gentoo": + options.repo = distro; + break; + case "ubuntu": + options.repo = distro ~ "_" ~ + release.strip("\"").replaceFirst(".", "_"); + break; + case "slackware": + options.repo = "slackbuilds"; + break; + } + } catch (std.file.FileException) {} } auto opts = getopt( @@ -141,6 +140,11 @@ return 1; } + if (!options.repo) { + stderr.writeln("repology: specify your repo with the --repo flag"); + return 1; + } + switch (options.repo) { case "alpine": options.repo = "alpine_edge";