home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / etc / bash_completion.d / bzip2 < prev    next >
Encoding:
Text File  |  2010-11-16  |  1.1 KB  |  51 lines

  1. # bash completion for bzip2
  2.  
  3. have bzip2 || have pbzip2 &&
  4. _bzip2()
  5. {
  6.     local cur prev xspec helpopts
  7.  
  8.     COMPREPLY=()
  9.     _get_comp_words_by_ref cur prev
  10.     helpopts=`_parse_help ${COMP_WORDS[0]}`
  11.  
  12.     case $prev in
  13.         -b|-h|--help|-p)
  14.             return 0
  15.             ;;
  16.     esac
  17.  
  18.     if [[ "$cur" == -* ]]; then
  19.         COMPREPLY=( $( compgen -W "${helpopts//#/} -2 -3 -4 -5 -6 -7 -8 -9" \
  20.             -- "$cur" ) )
  21.         return 0
  22.     fi
  23.  
  24.     local IFS=$'\t\n'
  25.  
  26.     xspec="*.bz2"
  27.     if [[ "$prev" == --* ]]; then
  28.         [[ "$prev" == --decompress || \
  29.             "$prev" == --list || \
  30.             "$prev" == --test ]] && xspec="!"$xspec
  31.         [[ "$prev" == --compress ]] && xspec=
  32.     elif [[ "$prev" == -* ]]; then
  33.         [[ "$prev" == -*[dt]* ]] && xspec="!"$xspec
  34.         [[ "$prev" == -*z* ]] && xspec=
  35.     fi
  36.  
  37.     _expand || return 0
  38.  
  39.     COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
  40.         $( compgen -d -- "$cur" ) )
  41. } &&
  42. complete -F _bzip2 -o filenames bzip2 pbzip2
  43.  
  44. # Local variables:
  45. # mode: shell-script
  46. # sh-basic-offset: 4
  47. # sh-indent-comment: t
  48. # indent-tabs-mode: nil
  49. # End:
  50. # ex: ts=4 sw=4 et filetype=sh
  51.