From 6ae78695efa8c222d716db267041f3ad19114d98 Mon Sep 17 00:00:00 2001 From: Mario A Date: Sun, 14 Feb 2021 14:44:59 +0100 Subject: [PATCH] feat(command-not-found): add support for Termux (#9666) --- plugins/command-not-found/README.md | 1 + plugins/command-not-found/command-not-found.plugin.zsh | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/plugins/command-not-found/README.md b/plugins/command-not-found/README.md index 1cf4ba66e..f267f0c89 100644 --- a/plugins/command-not-found/README.md +++ b/plugins/command-not-found/README.md @@ -28,5 +28,6 @@ It works out of the box with the command-not-found packages for: - [macOS (Homebrew)](https://github.com/Homebrew/homebrew-command-not-found) - [Fedora](https://fedoraproject.org/wiki/Features/PackageKitCommandNotFound) - [NixOS](https://github.com/NixOS/nixpkgs/tree/master/nixos/modules/programs/command-not-found) +- [Termux](https://github.com/termux/command-not-found) You can add support for other platforms by submitting a Pull Request. diff --git a/plugins/command-not-found/command-not-found.plugin.zsh b/plugins/command-not-found/command-not-found.plugin.zsh index 8fdc8a647..cbf9a0a8e 100644 --- a/plugins/command-not-found/command-not-found.plugin.zsh +++ b/plugins/command-not-found/command-not-found.plugin.zsh @@ -53,3 +53,10 @@ if [[ -x /run/current-system/sw/bin/command-not-found ]]; then /run/current-system/sw/bin/command-not-found -- "$@" } fi + +# Termux: https://github.com/termux/command-not-found +if [[ -x /data/data/com.termux/files/usr/libexec/termux/command-not-found ]]; then + command_not_found_handler() { + /data/data/com.termux/files/usr/libexec/termux/command-not-found -- "$1" + } +fi