From d84e2bc9aae4f01b1e02edd0a4a34dc57f072844 Mon Sep 17 00:00:00 2001 From: ianmacd <> Date: Sat, 25 Feb 2006 10:49:40 +0000 Subject: [PATCH] vncviewer(1) completion by Dean Montgomery . --- bash_completion | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/bash_completion b/bash_completion index 98824e80..f0dcf7dc 100644 --- a/bash_completion +++ b/bash_completion @@ -1,7 +1,7 @@ # bash_completion - programmable completion functions for bash 3.x # (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 # @@ -8591,6 +8591,35 @@ _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() { local IFS cur xspec