/bash_completion_lib/complete -o default/dropdb

http://github.com/brinkman83/bashrc · #! · 32 lines · 25 code · 7 blank · 0 comment · 0 complexity · a9319f15f7214c98ed49819928d572bf MD5 · raw file

  1. comp_include _get_cword _known_hosts _pg_databases _pg_users
  2. _dropdb()
  3. {
  4. local cur prev
  5. COMPREPLY=()
  6. cur=`_get_cword`
  7. prev=${COMP_WORDS[COMP_CWORD-1]}
  8. case "$prev" in
  9. -@(h|-host=))
  10. _known_hosts
  11. return 0
  12. ;;
  13. -@(U|-username=))
  14. _pg_users
  15. return 0
  16. ;;
  17. esac
  18. if [[ "$cur" == -* ]]; then
  19. COMPREPLY=( $( compgen -W '-h -p -U -W -e -q \
  20. --host= --port= --username= --password \
  21. --interactive --echo --quiet --help' -- $cur ) )
  22. else
  23. _pg_databases
  24. fi
  25. } # _dropdb()