Add iftop(8) completion.

This commit is contained in:
Ville Skyttä 2010-09-10 00:12:03 +03:00
parent 0630139697
commit c78db545f5
5 changed files with 58 additions and 1 deletions

View File

@ -8,7 +8,7 @@ bash-completion (2.x)
[ Ville Skyttä ]
* Activate hping2 completion also for hping and hping3.
* Add crontab, lrzip, and POSIX sh completions.
* Add crontab, iftop, lrzip, and POSIX sh completions.
* Add *.gif (Alioth: #312512), *.3gpp, *.3gpp2, and *.awb to mplayer
filename completions.
* Add "short" tarball extensions to unxz, unlzma etc completions.

View File

@ -51,6 +51,7 @@ static_bashcomp = abook \
heimdal \
hping2 \
iconv \
iftop \
ifupdown \
imagemagick \
info \

35
contrib/iftop Normal file
View File

@ -0,0 +1,35 @@
# iftop(8) completion
have iftop &&
_iftop()
{
COMPREPLY=()
local cur prev
_get_comp_words_by_ref cur prev
case $prev in
-h|-f|-F|-m)
return 0
;;
-i)
_available_interfaces -a
return 0
;;
-c)
_filedir
return 0
;;
esac
COMPREPLY=( $( compgen -W '-h -n -N -p -P -b -B -i -f -F -c -m' \
-- "$cur" ) )
} &&
complete -F _iftop -o filenames iftop
# Local variables:
# mode: shell-script
# sh-basic-offset: 4
# sh-indent-comment: t
# indent-tabs-mode: nil
# End:
# ex: ts=4 sw=4 et filetype=sh

View File

@ -0,0 +1 @@
assert_source_completions iftop

View File

@ -0,0 +1,20 @@
proc setup {} {
save_env
}
proc teardown {} {
assert_env_unmodified
}
setup
assert_complete_any "iftop "
sync_after_int
teardown