tree.bashcomp 926 B

1234567891011121314151617181920212223242526272829303132333435
  1. # Copyright © 2005 TUBITAK/UEKAE
  2. # Licensed under the GNU General Public License, version 2.
  3. # See the file http://www.gnu.org/copyleft/gpl.txt.
  4. #
  5. # Original work belongs Gentoo Linux
  6. _tree() {
  7. local cur prev opts
  8. COMPREPLY=()
  9. cur="${COMP_WORDS[COMP_CWORD]}"
  10. prev="${COMP_WORDS[COMP_CWORD-1]}"
  11. opts="-a -d -l -f -i -q -N -p -u -g -s -h -D -F -v -r -t -x -L -A
  12. -S -n -C -P -I -H -T -R -o --inodes --device --noreport --nolinks
  13. --dirsfirst --charset --filelimit --help"
  14. if [[ ${cur} == -* ]] ; then
  15. COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
  16. return 0
  17. fi
  18. case "${prev}" in
  19. -L|-P|-I|-H|-T|--charset|--help)
  20. ;;
  21. -o)
  22. COMPREPLY=( $(compgen -f -- ${cur}) )
  23. ;;
  24. *)
  25. COMPREPLY=( $(compgen -d -- ${cur}) )
  26. ;;
  27. esac
  28. }
  29. complete -o filenames -F _tree tree
  30. # vim: set ft=sh tw=80 sw=4 et :