Hello,

the following file should do autocompletion in bash for
clusterssh-clusters

$ cat /etc/bash_completion.d/clusterssh 
_cssh() {
local cur prev base
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"

if [[ ${cur} == -* ]]; then
  opts=$( cssh --help 2>&1 | egrep '\-\-' | awk -F, '{ print $1 }' )
  COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
  return 0
else
  if [ -f $HOME/.clusterssh/clusters ]; then
    local tags=$( cat $HOME/.clusterssh/clusters | awk '{ print $1 }' )
    COMPREPLY=( $(compgen -W "${tags}" -- ${cur}) )
  fi
  return 0
fi
}
complete -F _cssh cssh

-- 
  <oli...@la-familia-grande.de>  GnuPG-Fingerprint:
  31F8 1667 712C ED9E EDDC 42D2 EC82 8304 92E2 7B15
  http://www.la-familia-grande.de/keys/92e27b15.txt

Attachment: pgpjt9guljIdg.pgp
Description: Digitale Signatur von OpenPGP

Reply via email to