mirror of
https://github.com/KDE/kde-linux.git
synced 2026-04-18 05:29:01 -04:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user