From 4a81c1409c7bf4beea8cd96f000212730c9292bb Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 5 May 2025 19:02:13 -0400 Subject: [PATCH] Add patch for fixing bash completions --- libsixel-fix-bash-completions.patch | 38 +++++++++++++++++++++++++++++ libsixel.spec | 4 +++ 2 files changed, 42 insertions(+) create mode 100644 libsixel-fix-bash-completions.patch diff --git a/libsixel-fix-bash-completions.patch b/libsixel-fix-bash-completions.patch new file mode 100644 index 0000000..cd1179b --- /dev/null +++ b/libsixel-fix-bash-completions.patch @@ -0,0 +1,38 @@ +From 0614b54ffb3d1c66965f05d5865db80c44dd6b97 Mon Sep 17 00:00:00 2001 +From: Yao Zi +Date: Mon, 27 Jan 2025 17:17:11 +0000 +Subject: [PATCH] Make completion file compatible with newer bash-completion + +Function _have was renamed as _comp_have_command in bash-completion +commit 6381fd1f ("refactor: `_have => _comp_have_command`") in 2022. +Since it's relatively recent, let's provide a wrapper to handle the +API change. + +This fixes error message like "bash: have: command not found" when +completing img2sixel command with bash-completion 2.16.0. + +Signed-off-by: Yao Zi +--- + converters/shell-completion/bash/img2sixel | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/converters/shell-completion/bash/img2sixel b/converters/shell-completion/bash/img2sixel +index 028651bd..306cf895 100644 +--- a/converters/shell-completion/bash/img2sixel ++++ b/converters/shell-completion/bash/img2sixel +@@ -1,6 +1,14 @@ + # bash completion for img2sixel + +-have img2sixel && ++_libsixel_command_exist() { ++ if declare -F _comp_have_command > /dev/null; then ++ _comp_have_command "$1" ++ else ++ have "$1" ++ fi ++} ++ ++_libsixel_command_exist img2sixel && + _img2sixel() + { + local cur prev diff --git a/libsixel.spec b/libsixel.spec index e7155aa..3a0a97c 100644 --- a/libsixel.spec +++ b/libsixel.spec @@ -7,6 +7,10 @@ License: MIT URL: https://github.com/libsixel/libsixel Source: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz +# https://github.com/libsixel/libsixel/issues/81 +# Taken from https://github.com/libsixel/libsixel/pull/89 +Patch: libsixel-fix-bash-completions.patch + BuildRequires: gcc BuildRequires: meson BuildRequires: pkgconfig(gdlib)