mssh.bash-completion 600 B

12345678910111213141516171819202122232425262728293031323334
  1. # bash completion for mssh
  2. # Written by Héctor García <[email protected]>
  3. _mssh_alias()
  4. {
  5. COMPREPLY=( $( compgen -W '$( command cat ~/.mssh_clusters 2>/dev/null \
  6. | grep -v "^\s*$" | grep -v "^#" | sed -e "s/:.*$//" )' -- $cur ) )
  7. }
  8. _mssh()
  9. {
  10. local cur=${COMP_WORDS[COMP_CWORD]}
  11. local prev=${COMP_WORDS[COMP_CWORD-1]}
  12. COMPREPLY=()
  13. case "$prev" in
  14. -a)
  15. _mssh_alias
  16. return 0
  17. ;;
  18. esac
  19. # completing -a option
  20. if [[ "$cur" == -* ]]; then
  21. COMPREPLY=( $( compgen -W "-a" -- $cur ) )
  22. return 0
  23. fi
  24. _known_hosts_real "$cur"
  25. }
  26. complete -F _mssh mssh