completions/dnf: Fix completions for DNF5 (#9862)
Some checks are pending
make test / ubuntu (push) Waiting to run
make test / ubuntu-32bit-static-pcre2 (push) Waiting to run
make test / ubuntu-asan (push) Waiting to run
make test / macos (push) Waiting to run
Rust checks / rustfmt (push) Waiting to run
Rust checks / clippy (push) Waiting to run

Since DNF5 there's no implicit \n in repoquery output. For DNF4 this change
leaves blank lines in the output, but they are ignored anyway.
This commit is contained in:
Dmitry Gerasimov 2024-12-26 18:52:15 +01:00 committed by Peter Ammon
parent 6515862095
commit c473aa60a7

View File

@ -3,7 +3,7 @@
#
function __dnf_list_installed_packages
dnf repoquery --cacheonly "$cur*" --qf "%{name}" --installed </dev/null
dnf repoquery --cacheonly "$cur*" --qf "%{name}\n" --installed </dev/null
end
function __dnf_list_available_packages
@ -26,7 +26,7 @@ function __dnf_list_available_packages
else
# In some cases dnf will ask for input (e.g. to accept gpg keys).
# Connect it to /dev/null to try to stop it.
set results (dnf repoquery --cacheonly "$tok*" --qf "%{name}" --available </dev/null 2>/dev/null)
set results (dnf repoquery --cacheonly "$tok*" --qf "%{name}\n" --available </dev/null 2>/dev/null)
end
if set -q results[1]
set results (string match -r -- '.*\\.rpm$' $files) $results