Skip to content

Commit

Permalink
dpkg-deb: fix --show/-W completion
Browse files Browse the repository at this point in the history
  • Loading branch information
scop committed May 17, 2020
1 parent 2255f2a commit 2eee0b5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
12 changes: 10 additions & 2 deletions completions/dpkg
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,26 @@ _dpkg()

case $prev in
--install | --unpack | --record-avail | --contents | --info | --fsys-tarfile | \
--field | --control | --extract | --vextract | -!(-*)[ciAIfexW])
--field | --control | --extract | --vextract | -!(-*)[ciAIfex])
_filedir '?(u|d)deb'
return
;;
--build | -!(-*)b)
_filedir -d
return
;;
--status | --print-avail | --list | --show | -!(-*)[splW])
--status | --print-avail | --list | -!(-*)[spl])
COMPREPLY=($(_xfunc apt-cache _apt_cache_packages))
return
;;
--show | -!(-*)W)
if [[ $1 == *dpkg-query ]]; then
COMPREPLY=($(_xfunc apt-cache _apt_cache_packages))
else
_filedir '?(u|d)deb'
fi
return
;;
--search | -!(-*)S)
_filedir
return
Expand Down
Empty file.
4 changes: 4 additions & 0 deletions test/t/test_dpkg_deb.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ class TestDpkgDeb:
@pytest.mark.complete("dpkg-deb --c", require_cmd=True)
def test_1(self, completion):
assert completion

@pytest.mark.complete("dpkg-deb --show b", cwd="dpkg")
def test_show(self, completion):
assert completion == "bash-completion-test-subject.deb"

0 comments on commit 2eee0b5

Please sign in to comment.