host: New completion.
This commit is contained in:
parent
c328b91352
commit
bd07926f65
@ -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
1
test/completion/host.exp
Normal file
@ -0,0 +1 @@
|
||||
assert_source_completions host
|
20
test/lib/completions/host.exp
Normal file
20
test/lib/completions/host.exp
Normal file
@ -0,0 +1,20 @@
|
||||
proc setup {} {
|
||||
save_env
|
||||
}
|
||||
|
||||
|
||||
proc teardown {} {
|
||||
assert_env_unmodified
|
||||
}
|
||||
|
||||
|
||||
setup
|
||||
|
||||
|
||||
assert_complete_any "host -"
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
||||
|
||||
teardown
|
Loading…
x
Reference in New Issue
Block a user