completions/dnf: Only offer the packagename

Removing the extraneous cruft.

Really, this should just be using its database properly.

Fixes #7118.
This commit is contained in:
Fabian Homborg 2020-06-20 19:56:33 +02:00
parent 197d615cc8
commit d8e5dfbb51

View File

@ -8,7 +8,11 @@ end
function __dnf_list_available_packages
if type -q sqlite3
sqlite3 /var/cache/dnf/packages.db "SELECT pkg FROM available WHERE pkg LIKE \"$cur%\"" 2>/dev/null
# This schema is bad, there is only a "pkg" field with the full
# packagename-version-release.fedorarelease.architecture
# tuple. We are only interested in the packagename.
sqlite3 /var/cache/dnf/packages.db "SELECT pkg FROM available WHERE pkg LIKE \"$cur%\"" 2>/dev/null |
string replace -r -- '-[^-]*-[^-]*$' ''
end
end
@ -305,4 +309,4 @@ complete -c dnf -n __fish_no_arguments -l skip-broken -d "Skips broken packages"
complete -c dnf -n __fish_no_arguments -l showduplicates -d "Shows duplicate packages"
complete -c dnf -n __fish_no_arguments -s v -l verbose -d "Verbose mode"
complete -c dnf -n __fish_no_arguments -l version -d "Shows DNF version and exit"
complete -c dnf -n __fish_no_arguments -s y -l assumeyes -d "Answer yes for all questions"
complete -c dnf -n __fish_no_arguments -s y -l assumeyes -d "Answer yes for all questions"