OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.2 KiB

  1. #!/bin/bash
  2. #
  3. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  4. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  5. #
  6. # Filename: package/.../bashcompletion/usr_bin_bashcomp.sh
  7. # Copyright (C) 2004 - 2006 The T2 SDE Project
  8. # Copyright (C) 1998 - 2004 Clifford Wolf
  9. #
  10. # More information can be found in the files COPYING and README.
  11. #
  12. # This program is free software; you can redistribute it and/or modify
  13. # it under the terms of the GNU General Public License as published by
  14. # the Free Software Foundation; version 2 of the License. A copy of the
  15. # GNU General Public License can be found in the file COPYING.
  16. # --- SDE-COPYRIGHT-NOTE-END ---
  17. if [ -z "$*" ]
  18. then
  19. . /etc/bash_completion
  20. complete | sed "s, -F \([^ ]*\), -C '$0 \1',"
  21. tmpfile=$( mktemp $HOME/.bashcomp.XXXXXXXXXX )
  22. declare -f > $tmpfile
  23. mv $tmpfile $HOME/.bashcomp.cache
  24. else
  25. # Have: COMP_LINE COMP_POINT
  26. # Need: COMP_CWORD COMP_WORDS
  27. COMP_WORDS=( $COMP_LINE )
  28. remain=( ${COMP_LINE:COMP_POINT} )
  29. COMP_CWORD=$(( ${#COMP_WORDS[@]} - ${#remain[@]} ))
  30. ch="${COMP_LINE:COMP_POINT-1:1}"
  31. [ -z "${ch//[ ]/}" ] || (( COMP_CWORD = COMP_CWORD - 1 ))
  32. shopt -s extglob
  33. . $HOME/.bashcomp.cache
  34. "$@" # run the completion function
  35. for x in "${COMPREPLY[@]}"; do echo "$x"; done
  36. fi