PageRenderTime 3ms CodeModel.GetById 1ms app.highlight 1ms RepoModel.GetById 0ms app.codeStats 1ms

/bash_completion_lib/complete/vncviewer

http://github.com/brinkman83/bashrc
#! | 30 lines | 23 code | 7 blank | 0 comment | 0 complexity | cee50f7e6950486674e2d8bada4009bb MD5 | raw file
 1# vncviewer(1) completion
 2
 3
 4comp_include _get_cword _known_hosts
 5
 6
 7_vncviewer()
 8{
 9    local cur prev
10    local -a config
11    
12    COMPREPLY=()
13    cur=`_get_cword`
14    prev=${COMP_WORDS[COMP_CWORD-1]}
15
16    case "$prev" in
17    -via)
18       _known_hosts -a
19       ;;
20    *)
21       # ssh into the the server, find and ping the broadcast address, then
22       # sort and show the results.
23       COMPREPLY=( $( ssh -o 'Batchmode yes' $prev \
24              "ping -bnc 4 255.255.255.255" 2>/dev/null | \
25              awk -F ' ' '{print $4}' | \
26              sort -n | uniq | egrep '[0-9]+\.[0-9]+\.' 2>/dev/null ) )
27    esac
28                                   
29    return 0
30} # _vncviewer()