diff --git a/share/completions/dnf.fish b/share/completions/dnf.fish index 0e1e72b7f..7320fe026 100644 --- a/share/completions/dnf.fish +++ b/share/completions/dnf.fish @@ -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" \ No newline at end of file +complete -c dnf -n __fish_no_arguments -s y -l assumeyes -d "Answer yes for all questions"