Skip to content

Commit 8bea1ec

Browse files
committed
inotifywait: New completion
1 parent 5af8f75 commit 8bea1ec

File tree

4 files changed

+52
-0
lines changed

4 files changed

+52
-0
lines changed

completions/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ bashcomp_DATA = 2to3 \
160160
ifup \
161161
info \
162162
inject \
163+
inotifywait \
163164
insmod \
164165
installpkg \
165166
interdiff \

completions/inotifywait

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# bash completion for inotifywait(1) -*- shell-script -*-
2+
3+
_inotifywait()
4+
{
5+
local cur prev words cword
6+
_init_completion || return
7+
8+
case $prev in
9+
--help|--exclude|--excludei|--format|--timefmt|--timeout|-!(-*)[ht])
10+
return
11+
;;
12+
--fromfile|--outfile|-!(-*)o)
13+
_filedir
14+
return
15+
;;
16+
--event|-!(-*)e)
17+
COMPREPLY=( $( compgen -W "$( $1 --help 2>/dev/null | \
18+
sed -e '/^Events:/,/^[^ \t]/!d' \
19+
-ne 's/^[ \t]\{1,\}\([^ \t]\{1,\}\)[ \t].*/\1/p' )" \
20+
-- "$cur" ) )
21+
return
22+
;;
23+
esac
24+
25+
if [[ "$cur" == -* ]]; then
26+
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
27+
return
28+
fi
29+
30+
_filedir
31+
} &&
32+
complete -F _inotifywait inotifywait
33+
34+
# ex: filetype=sh

test/t/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ EXTRA_DIST = \
232232
test_import.py \
233233
test_info.py \
234234
test_inject.py \
235+
test_inotifywait.py \
235236
test_insmod.py \
236237
test_installpkg.py \
237238
test_interdiff.py \

test/t/test_inotifywait.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import pytest
2+
3+
4+
class TestInotifywait:
5+
6+
@pytest.mark.complete("inotifywait ")
7+
def test_1(self, completion):
8+
assert completion.list
9+
10+
@pytest.mark.complete("inotifywait --")
11+
def test_2(self, completion):
12+
assert completion.list
13+
14+
@pytest.mark.complete("inotifywait -e ")
15+
def test_3(self, completion):
16+
assert completion.list

0 commit comments

Comments
 (0)