55 lines
1.1 KiB
Bash
55 lines
1.1 KiB
Bash
# bash completion for tcpdump
|
|
|
|
have tcpdump || return
|
|
|
|
_tcpdump()
|
|
{
|
|
local cur prev words cword
|
|
_init_completion || return
|
|
|
|
case $prev in
|
|
-r|-w|-F)
|
|
_filedir
|
|
return 0
|
|
;;
|
|
-i)
|
|
_available_interfaces -a
|
|
return 0
|
|
;;
|
|
-m)
|
|
_filedir mib
|
|
return 0
|
|
;;
|
|
-T)
|
|
COMPREPLY=( $( compgen -W 'aodv cnfp rpc rtp rtcp snmp tftp vat
|
|
wb' -- "$cur" ) )
|
|
return 0
|
|
;;
|
|
-z)
|
|
COMPREPLY=( $( compgen -c -- "$cur" ) )
|
|
return 0
|
|
;;
|
|
-Z)
|
|
_allowed_users
|
|
return 0
|
|
;;
|
|
-B|-c|-C|-D|-E|-G|-M|-s|-W|-y)
|
|
return 0
|
|
;;
|
|
esac
|
|
|
|
if [[ "$cur" == -* ]]; then
|
|
COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) )
|
|
fi
|
|
|
|
} &&
|
|
complete -F _tcpdump tcpdump
|
|
|
|
# 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
|