f8c76d55a7c26ba7061d95ed4ba7fb200f3e6cde

Author
theVerusDev <richard.p23@protonmail.com>
Committer
GitHub <noreply@github.com>
Date

Message

feat(cnf): Added support for SUSE-derived operation systems (ZYpp) to CNF plugin (#10508)

* Added support for SUSE and derivatives for command-not-found plugin

* Updated command-not-found documentation to list support for SUSE and derivatives

Diff

 1diff --git a/plugins/command-not-found/README.md b/plugins/command-not-found/README.md
 2index f267f0c89ec47d5eebad5743cbffcc5ef53b3f4e..5a373c53724f1662103f3e9e58c5e5cc3c4c7520 100644
 3--- a/plugins/command-not-found/README.md
 4+++ b/plugins/command-not-found/README.md
 5@@ -29,5 +29,6 @@ It works out of the box with the command-not-found packages for:
 6 - [Fedora](https://fedoraproject.org/wiki/Features/PackageKitCommandNotFound)
 7 - [NixOS](https://github.com/NixOS/nixpkgs/tree/master/nixos/modules/programs/command-not-found)
 8 - [Termux](https://github.com/termux/command-not-found)
 9+- [SUSE](https://www.unix.com/man-page/suse/1/command-not-found/)
10 
11 You can add support for other platforms by submitting a Pull Request.
12diff --git a/plugins/command-not-found/command-not-found.plugin.zsh b/plugins/command-not-found/command-not-found.plugin.zsh
13index e4635060465e3310c0923b2423b562e3154afc97..cb8a8989c53602ecc1b0bacf07d665f3b4163f62 100644
14--- a/plugins/command-not-found/command-not-found.plugin.zsh
15+++ b/plugins/command-not-found/command-not-found.plugin.zsh
16@@ -60,3 +60,10 @@ if [[ -x /data/data/com.termux/files/usr/libexec/termux/command-not-found ]]; th
17     /data/data/com.termux/files/usr/libexec/termux/command-not-found "$1"
18   }
19 fi
20+
21+# SUSE and derivates: https://www.unix.com/man-page/suse/1/command-not-found/
22+if [[ -x /usr/bin/command-not-found ]]; then
23+  command_not_found_handler() {
24+    /usr/bin/command-not-found "$1"
25+  }
26+fi