6ae78695efa8c222d716db267041f3ad19114d98

Author
Mario A <marioanacl22@gmail.com>
Committer
Marc Cornellà <hello@mcornella.com>
Date

Message

feat(command-not-found): add support for Termux (#9666)

Diff

 1diff --git a/plugins/command-not-found/README.md b/plugins/command-not-found/README.md
 2index 1cf4ba66e10b7fcc6a0da7331c9551f4dcd3f865..f267f0c89ec47d5eebad5743cbffcc5ef53b3f4e 100644
 3--- a/plugins/command-not-found/README.md
 4+++ b/plugins/command-not-found/README.md
 5@@ -28,5 +28,6 @@ It works out of the box with the command-not-found packages for:
 6 - [macOS (Homebrew)](https://github.com/Homebrew/homebrew-command-not-found)
 7 - [Fedora](https://fedoraproject.org/wiki/Features/PackageKitCommandNotFound)
 8 - [NixOS](https://github.com/NixOS/nixpkgs/tree/master/nixos/modules/programs/command-not-found)
 9+- [Termux](https://github.com/termux/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 8fdc8a6471d87c184d3fb6b14d2cecc4575b3b01..cbf9a0a8e5c2a67fdcea9b5a49cb4cbb89d0674d 100644
14--- a/plugins/command-not-found/command-not-found.plugin.zsh
15+++ b/plugins/command-not-found/command-not-found.plugin.zsh
16@@ -53,3 +53,10 @@ if [[ -x /run/current-system/sw/bin/command-not-found ]]; then
17     /run/current-system/sw/bin/command-not-found -- "$@"
18   }
19 fi
20+
21+# Termux: https://github.com/termux/command-not-found
22+if [[ -x /data/data/com.termux/files/usr/libexec/termux/command-not-found ]]; then
23+  command_not_found_handler() {
24+    /data/data/com.termux/files/usr/libexec/termux/command-not-found -- "$1"
25+  }
26+fi