[debian] Exclude packages with dpkg state 'deinstall' from installed list

When listing packages already installed (e.g. for use with `apt remove
...`), do not consider packages return by `dpkg --get-selections` with
state 'deinstall'.

Previously the `string replace` pattern was matching both 'install' and
'deinstall' packages.
This commit is contained in:
Mahmoud Al-Qudsi 2018-07-28 17:19:30 -05:00
parent 32ca6118a6
commit 1ca58984bf

View file

@ -21,7 +21,7 @@ function __fish_print_packages
if type -q -f apt-cache if type -q -f apt-cache
if set -q only_installed if set -q only_installed
dpkg --get-selections | string replace -r '(\S+).*' "\$1\t$package" dpkg --get-selections | string replace -fr '(\S+)\s+install' "\$1\t$package"
return return
else else
# Do not generate the cache as apparently sometimes this is slow. # Do not generate the cache as apparently sometimes this is slow.