Added more commands to the command-not-found handler

This adds some more package-managers to the command-not-found handler and
adds a way to detect if two or more missing commands belong to the same
program.
This commit is contained in:
Jonas Harer
2026-02-25 15:02:50 +00:00
committed by Nate Graham
parent 4b43c460bc
commit f5d1fec349

View File

@@ -22,19 +22,20 @@ known_alternatives = {
"netstat" : "ss",
"nslookup" : "resolvectl query",
"route" : "ip route",
"service" :"systemctl",
"service" : "systemctl",
"traceroute" : "tracepath"
}
unsupported_package_managers = [
"apt",
"apt-get",
"dnf",
"dpkg",
"npm",
"pacman",
"pamac",
"portage",
"rpm",
"yay",
"yum",
"zypper"
]
@@ -44,8 +45,21 @@ available_package_managers = {
"nix" : "https://kde.org/linux/docs/more-software/#nix"
}
related_commands = {
"nix-env" : "nix",
"nix-shell" : "nix",
"nix-store" : "nix",
"apt-cache" : "apt",
"apt-config" : "apt",
"apt-get" : "apt",
"apt-mark" : "apt"
}
command = sys.argv[1]
if command in related_commands:
command = related_commands[command]
if command in known_alternatives:
print("\nKDE Linux does not include the “%s” tool.\n\nInstead, try using “%s”.\n" % (command, known_alternatives[command]))
exit(127)