/bash_completion_lib/complete-nohostcomplete/ssh

http://github.com/brinkman83/bashrc · #! · 50 lines · 43 code · 7 blank · 0 comment · 0 complexity · 443ed8b2dea1f57deaec863e71e42cd9 MD5 · raw file

  1. comp_include _dequote _filedir _get_cword _known_hosts
  2. _ssh()
  3. {
  4. local cur optconfigfile prev
  5. local -a config
  6. COMPREPLY=()
  7. cur=`_get_cword`
  8. prev=${COMP_WORDS[COMP_CWORD-1]}
  9. case "$prev" in
  10. -F)
  11. _filedir
  12. ;;
  13. -*c)
  14. COMPREPLY=( $( compgen -W 'blowfish 3des 3des-cbc blowfish-cbc \
  15. arcfour cast128-cbc' -- $cur ) )
  16. ;;
  17. -*i)
  18. _filedir
  19. ;;
  20. -*l)
  21. COMPREPLY=( $( compgen -u -- $cur ) )
  22. ;;
  23. *)
  24. # Search COMP_WORDS for '-F[ ]configfile' argument
  25. set -- "${COMP_WORDS[@]}"
  26. while [ $# -gt 0 ]; do
  27. if [ "${1:0:2}" = -F ]; then
  28. if [ ${#1} -gt 2 ]; then
  29. optconfigfile="$(_dequote "$1")"
  30. else
  31. shift
  32. [ "$1" ] && optconfigfile="$(_dequote "-F$1")"
  33. fi
  34. break
  35. fi
  36. shift
  37. done
  38. _known_hosts -a "$optconfigfile"
  39. [ $COMP_CWORD -eq 1 -o -n "$optconfigfile" ] || \
  40. COMPREPLY=( "${COMPREPLY[@]}" $( compgen -c -- $cur ) )
  41. esac
  42. return 0
  43. }