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 / cpio < prev    next >
Encoding:
Text File  |  2010-11-16  |  3.2 KB  |  103 lines

  1. # bash completion for cpio
  2.  
  3. have cpio && {
  4. _cpio_format()
  5. {
  6.     COMPREPLY=( $( compgen -W 'bin odc newc crc tar ustar hpbin hpodc' -- "$cur" ) )
  7. }
  8.  
  9. _cpio()
  10. {
  11.     local cur prev split=false
  12.  
  13.     COMPREPLY=()
  14.     _get_comp_words_by_ref -n : cur prev
  15.  
  16.     _split_longopt && split=true
  17.  
  18.     # --name value style option
  19.     case $prev in
  20.         -H|--format)
  21.             _cpio_format
  22.             return 0
  23.             ;;
  24.         -E|-F|-I|--file|--pattern-file)
  25.             _filedir
  26.             return 0
  27.             ;;
  28.         -R|--owner)
  29.             _usergroup
  30.             return 0
  31.             ;;
  32.         --rsh-command)
  33.             COMPREPLY=( $( compgen -c -- "$cur" ) )
  34.             return 0
  35.             ;;
  36.     esac
  37.  
  38.     $split && return 0
  39.  
  40.     if [ $COMP_CWORD -eq 1 ]; then
  41.         COMPREPLY=( $( compgen -W '-o --create -i --extract -p --pass-through \
  42.                                    -? --help --license --usage --version' -- "$cur" ) )
  43.     else
  44.         case ${COMP_WORDS[1]} in
  45.             -o|--create)
  46.                 if [[ "$cur" == -* ]]; then
  47.                     COMPREPLY=( $( compgen -W '-0 -a -c -v -A -B\
  48.                         -L -V -C -H -M -O -F --file --format\
  49.                         --message --null --reset-access-time\
  50.                         --verbose --dot --append --block-size\
  51.                         --dereference --io-size --quiet\
  52.                         --force-local --rsh-command --help\
  53.                         --version' -- "$cur" ) )
  54.                 fi
  55.                 ;;
  56.             -i|--extract)
  57.                 if [[ "$cur" == -* ]]; then
  58.                     COMPREPLY=( $( compgen -W '-b -c -d -f -m -n -r\
  59.                         -t -s -u -v -B -S -V -C -E -H -M -R -I\
  60.                         -F --file --make-directories\
  61.                         --nonmatching\
  62.                         --preserve-modification-time\
  63.                         --numeric-uid-gid --rename -t --list\
  64.                         --swap-bytes --swap --dot\
  65.                         --unconditional --verbose --block-size\
  66.                         --swap-halfwords --io-size\
  67.                         --pattern-file --format --owner\
  68.                         --no-preserve-owner --message\
  69.                         --force-local --no-absolute-filenames\
  70.                         --sparse --only-verify-crc --quiet\
  71.                         --rsh-command --help\
  72.                         --to-stdout \
  73.                         --version' -- "$cur" ) )
  74.                 fi
  75.                 ;;
  76.             -p|--pass-through)
  77.                 if [[ "$cur" == -* ]]; then
  78.                     COMPREPLY=( $( compgen -W '-0 -a -d -l -m -u -v\
  79.                         -L -V -R --null --reset-access-time\
  80.                         --make-directories --link --quiet\
  81.                         --preserve-modification-time\
  82.                         --unconditional --verbose --dot\
  83.                         --dereference --owner\
  84.                         --no-preserve-owner --sparse --help\
  85.                         --version' -- "$cur" ) )
  86.                 else
  87.                     _filedir -d
  88.                 fi
  89.                 ;;
  90.         esac
  91.     fi
  92. }
  93. complete -F _cpio -o filenames cpio
  94. }
  95.  
  96. # Local variables:
  97. # mode: shell-script
  98. # sh-basic-offset: 4
  99. # sh-indent-comment: t
  100. # indent-tabs-mode: nil
  101. # End:
  102. # ex: ts=4 sw=4 et filetype=sh
  103.