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 / rsync < prev    next >
Encoding:
Text File  |  2010-11-16  |  3.5 KB  |  93 lines

  1. # bash completion for rsync
  2.  
  3. have rsync &&
  4. _rsync()
  5. {
  6.     # TODO: _split_longopt
  7.  
  8.     COMPREPLY=()
  9.     local cur prev
  10.     _get_comp_words_by_ref -n : cur prev
  11.  
  12.     _expand || return 0
  13.  
  14.     case $prev in
  15.         --config|--password-file|--include-from|--exclude-from)
  16.             _filedir
  17.             return 0
  18.             ;;
  19.         -T|--temp-dir|--compare-dest)
  20.             _filedir -d
  21.             return 0
  22.             ;;
  23.         -e|--rsh)
  24.             COMPREPLY=( $( compgen -W 'rsh ssh' -- "$cur" ) )
  25.             return 0
  26.             ;;
  27.         --compress-level)
  28.             COMPREPLY=( $( compgen -W '1 2 3 4 5 6 7 8 9' -- "$cur" ) )
  29.             return 0
  30.             ;;
  31.     esac
  32.  
  33.     case $cur in
  34.         -*)
  35.             COMPREPLY=( $( compgen -W '--verbose --quiet --no-motd --checksum \
  36.                 --archive --recursive --relative --no-implied-dirs \
  37.                 --backup --backup-dir --suffix= --update --inplace --append \
  38.                 --append-verify --dirs --old-dirs --links --copy-links \
  39.                 --copy-unsafe-links --safe-links --copy-dirlinks \
  40.                 --keep-dirlinks --hard-links --perms --executability --chmod= \
  41.                 --acls --xattrs --owner --group --devices --copy-devices \
  42.                 --specials --times --omit-dir-times --super --fake-super \
  43.                 --sparse --dry-run --whole-file --no-whole-file \
  44.                 --one-file-system --block-size= --rsh= --rsync-path= \
  45.                 --existing --ignore-existing --remove-source-files --delete \
  46.                 --delete-before --delete-during --delete-delay --delete-after \
  47.                 --delete-excluded --ignore-errors --force --max-delete= \
  48.                 --max-size= --min-size= --partial --partial-dir= \
  49.                 --delay-updates --prune-empty-dirs --numeric-ids --timeout= \
  50.                 --contimeout= --ignore-times --size-only --modify-window= \
  51.                 --temp-dir= --fuzzy --compare-dest= --copy-dest= --link-dest= \
  52.                 --compress --compress-level= --skip-compress= --cvs-exclude \
  53.                 --filter= --exclude= --exclude-from= --include= \
  54.                 --include-from= --files-from= --from0 --protect-args \
  55.                 --address= --port= --sockopts= --blocking-io --no-blocking-io \
  56.                 --stats --8-bit-output --human-readable --progress \
  57.                 --itemize-changes --out-format= --log-file= \
  58.                 --log-file-format= --password-file= --list-only --bwlimit= \
  59.                 --write-batch= --only-write-batch= --read-batch= --protocol= \
  60.                 --iconv= --ipv4 --ipv6 --version --help --daemon --config= \
  61.                 --no-detach' -- "$cur" ) )
  62.             ;;
  63.         *:*)
  64.             if type _scp_remote_files &>/dev/null; then
  65.                 # find which remote shell is used
  66.                 local i shell=ssh
  67.                 for (( i=1; i < COMP_CWORD; i++ )); do
  68.                     if [[ "${COMP_WORDS[i]}" == -@(e|-rsh) ]]; then
  69.                         shell=${COMP_WORDS[i+1]}
  70.                         break
  71.                     fi
  72.                 done
  73.                 [ "$shell" = ssh ] && _scp_remote_files
  74.             fi
  75.             ;;
  76.         *)
  77.             _known_hosts_real -c -a "$cur"
  78.             type _scp_local_files &>/dev/null && _scp_local_files || _filedir
  79.             ;;
  80.     esac
  81.  
  82.     return 0
  83. } &&
  84. complete -F _rsync -o nospace rsync
  85.  
  86. # Local variables:
  87. # mode: shell-script
  88. # sh-basic-offset: 4
  89. # sh-indent-comment: t
  90. # indent-tabs-mode: nil
  91. # End:
  92. # ex: ts=4 sw=4 et filetype=sh
  93.