Add patch for fixing bash completions

This commit is contained in:
ErrorNoInternet 2025-05-05 19:02:13 -04:00
commit 4a81c1409c
No known key found for this signature in database
GPG key ID: 2486BFB7B1E6A4A3
2 changed files with 42 additions and 0 deletions

View file

@ -0,0 +1,38 @@
From 0614b54ffb3d1c66965f05d5865db80c44dd6b97 Mon Sep 17 00:00:00 2001
From: Yao Zi <ziyao@disroot.org>
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 <ziyao@disroot.org>
---
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

View file

@ -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)