host: New completion.

This commit is contained in:
Ville Skyttä 2011-07-01 20:24:14 +03:00
parent c328b91352
commit bd07926f65
3 changed files with 51 additions and 1 deletions

View File

@ -1,6 +1,6 @@
# bash completion for nslookup
have nslookup || return
have nslookup || have host || return
_bind_queryclass()
{
@ -45,6 +45,35 @@ _nslookup()
} &&
complete -F _nslookup nslookup
_host()
{
local cur prev words cword
_init_completion || return
case $prev in
-c)
_bind_queryclass
return
;;
-t)
_bind_querytype
return
;;
-m)
COMPREPLY=( $( compgen -W 'trace record usage' -- "$cur" ) )
return
;;
-N|-R|-W)
return
;;
esac
if [[ $cur == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) )
fi
} &&
complete -F _host host
# Local variables:
# mode: shell-script
# sh-basic-offset: 4

1
test/completion/host.exp Normal file
View File

@ -0,0 +1 @@
assert_source_completions host

View File

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