tcpdump: Use _parse_usage, add bunch of option completions and a basic test case.
This commit is contained in:
parent
3334711726
commit
ae9e140948
@ -16,12 +16,30 @@ _tcpdump()
|
|||||||
_available_interfaces -a
|
_available_interfaces -a
|
||||||
return 0
|
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
|
esac
|
||||||
|
|
||||||
|
|
||||||
if [[ "$cur" == -* ]]; then
|
if [[ "$cur" == -* ]]; then
|
||||||
COMPREPLY=( $( compgen -W '-a -d -e -f -l -n -N -O -p \
|
COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) )
|
||||||
-q -R -S -t -u -v -x -C -F -i -m -r -s -T -w -E' -- "$cur" ) )
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
} &&
|
} &&
|
||||||
|
1
test/completion/tcpdump.exp
Normal file
1
test/completion/tcpdump.exp
Normal file
@ -0,0 +1 @@
|
|||||||
|
assert_source_completions tcpdump
|
20
test/lib/completions/tcpdump.exp
Normal file
20
test/lib/completions/tcpdump.exp
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
proc setup {} {
|
||||||
|
save_env
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
proc teardown {} {
|
||||||
|
assert_env_unmodified
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
setup
|
||||||
|
|
||||||
|
|
||||||
|
assert_complete_any "tcpdump -"
|
||||||
|
|
||||||
|
|
||||||
|
sync_after_int
|
||||||
|
|
||||||
|
|
||||||
|
teardown
|
Loading…
x
Reference in New Issue
Block a user