Skip to content

Commit 6b5c8d4

Browse files
committed
scrub: New completion
1 parent e00c119 commit 6b5c8d4

File tree

4 files changed

+62
-0
lines changed

4 files changed

+62
-0
lines changed

completions/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ bashcomp_DATA = 2to3 \
343343
sbcl \
344344
sbopkg \
345345
screen \
346+
scrub \
346347
sh \
347348
sitecopy \
348349
slackpkg \

completions/scrub

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# scrub(1) completion -*- shell-script -*-
2+
3+
_scrub()
4+
{
5+
local cur prev words cword split
6+
_init_completion -s || return
7+
8+
case $prev in
9+
--version|--help|--blocksize|--device-size|--dirent|-!(-*)[vhbsD])
10+
return
11+
;;
12+
--pattern|-!(-*)p)
13+
COMPREPLY=( $( compgen -W '$( "$1" --help 2>&1 |
14+
awk "/^Available/{flag=1;next}/^ /&&flag{print \$1}" )' \
15+
-- "$cur" ) )
16+
return
17+
;;
18+
--freespace|-!(-*)X)
19+
_filedir -d
20+
return
21+
;;
22+
esac
23+
24+
$split && return
25+
26+
if [[ $cur == -* ]]; then
27+
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
28+
[[ $COMPREPLY == *= ]] && compopt -o nospace
29+
return
30+
fi
31+
32+
_filedir
33+
} &&
34+
complete -F _scrub scrub
35+
36+
# ex: filetype=sh

test/completion/scrub.exp

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

test/lib/completions/scrub.exp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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 "scrub "
15+
sync_after_int
16+
17+
assert_complete_any "scrub -"
18+
sync_after_int
19+
20+
assert_complete_any "scrub -p "
21+
sync_after_int
22+
23+
24+
teardown

0 commit comments

Comments
 (0)