vncviewer(1) completion by Dean Montgomery <dmonty@sd73.bc.ca>.

This commit is contained in:
ianmacd 2006-02-25 10:49:40 +00:00
parent 8e4bddf52d
commit d84e2bc9aa

View File

@ -1,7 +1,7 @@
# bash_completion - programmable completion functions for bash 3.x # bash_completion - programmable completion functions for bash 3.x
# (backwards compatible with bash 2.05b) # (backwards compatible with bash 2.05b)
# #
# $Id: bash_completion,v 1.856 2006/02/25 11:37:32 ianmacd Exp $ # $Id: bash_completion,v 1.857 2006/02/25 11:49:40 ianmacd Exp $
# #
# Copyright (C) Ian Macdonald <ian@caliban.org> # Copyright (C) Ian Macdonald <ian@caliban.org>
# #
@ -8591,6 +8591,35 @@ _smartctl()
complete -F _smartctl smartctl complete -F _smartctl smartctl
} }
# vncviewer(1) completion
#
have vncviewer &&
_vncviewer()
{
local cur prev
local -a config
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in
-via)
_known_hosts -a
;;
*)
# ssh into the the server, find and ping the broadcast address, then
# sort and show the results.
COMPREPLY=( $( ssh -o 'Batchmode yes' $prev \
"ping -bnc 4 255.255.255.255" 2>/dev/null | \
awk -F ' ' '{print $4}' | \
sort -n | uniq | egrep '[0-9]+\.[0-9]+\.' 2>/dev/null ) )
esac
return 0
} &&
complete -F _vncviewer vncviewer
_filedir_xspec() _filedir_xspec()
{ {
local IFS cur xspec local IFS cur xspec