Skip to content

Commit ea3d2b2

Browse files
committed
lspci: New completion
1 parent 4e323d9 commit ea3d2b2

File tree

4 files changed

+64
-0
lines changed

4 files changed

+64
-0
lines changed

completions/lspci

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# lspci(8) completion -*- shell-script -*-
2+
3+
_lspci()
4+
{
5+
local cur prev words cword
6+
_init_completion || return
7+
8+
case $prev in
9+
-s|-D|-O)
10+
return
11+
;;
12+
-i)
13+
_filedir ids
14+
return
15+
;;
16+
-p)
17+
_filedir pcimap
18+
return
19+
;;
20+
-A)
21+
COMPREPLY+=( $( compgen -W '$( $1 -A help | command grep -vF : )' \
22+
-- "$cur") )
23+
return
24+
;;
25+
-H)
26+
COMPREPLY+=( $( compgen -W "1 2" -- "$cur" ) )
27+
return
28+
;;
29+
-F)
30+
_filedir
31+
return
32+
;;
33+
esac
34+
35+
if [[ $cur == -* ]]; then
36+
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
37+
fi
38+
} &&
39+
complete -F _lspci lspci
40+
41+
# ex: filetype=sh

test/completion/lspci.exp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
assert_source_completions lspci

test/docker/Dockerfile-ubuntu14

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ RUN dpkg --add-architecture i386 && \
148148
optipng \
149149
p7zip-full \
150150
patchutils \
151+
pciutils \
151152
perl-doc \
152153
pinfo \
153154
pm-utils \

test/lib/completions/lspci.exp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
proc setup {} {
2+
save_env
3+
}
4+
5+
6+
proc teardown {} {
7+
assert_env_unmodified
8+
}
9+
10+
11+
setup
12+
13+
14+
assert_complete_any "lspci -"
15+
sync_after_int
16+
17+
assert_complete_any "lspci -A "
18+
sync_after_int
19+
20+
21+
teardown

0 commit comments

Comments
 (0)