@@ -37,32 +37,15 @@ _rsync()
37
37
38
38
case $cur in
39
39
-* )
40
- COMPREPLY=($( compgen -W ' --verbose --quiet --no-motd --checksum
41
- --archive --recursive --relative --no-implied-dirs
42
- --backup --backup-dir= --suffix= --update --inplace --append
43
- --append-verify --dirs --old-dirs --links --copy-links
44
- --copy-unsafe-links --safe-links --copy-dirlinks
45
- --keep-dirlinks --hard-links --perms --executability --chmod=
46
- --acls --xattrs --owner --group --devices --copy-devices
47
- --specials --times --omit-dir-times --super --fake-super
48
- --sparse --dry-run --whole-file --no-whole-file
49
- --one-file-system --block-size= --rsh= --rsync-path=
50
- --existing --ignore-existing --remove-source-files --delete
51
- --delete-before --delete-during --delete-delay --delete-after
52
- --delete-excluded --ignore-errors --force --max-delete=
53
- --max-size= --min-size= --partial --partial-dir=
54
- --delay-updates --prune-empty-dirs --numeric-ids --timeout=
55
- --contimeout= --ignore-times --size-only --modify-window=
56
- --temp-dir= --fuzzy --compare-dest= --copy-dest= --link-dest=
57
- --compress --compress-level= --skip-compress= --cvs-exclude
58
- --filter= --exclude= --exclude-from= --include= --include-from=
59
- --files-from= --from0 --protect-args --address= --port=
60
- --sockopts= --blocking-io --no-blocking-io --stats
61
- --8-bit-output --human-readable --progress --itemize-changes
62
- --out-format= --log-file= --log-file-format= --password-file=
63
- --list-only --bwlimit= --write-batch= --only-write-batch=
64
- --read-batch= --protocol= --iconv= --ipv4 --ipv6 --version
65
- --help --daemon --config= --no-detach' -- " $cur " ) )
40
+ COMPREPLY=($(
41
+ # Account for the fact that older rsync versions (before cba00be6, meaning before v3.2.0)
42
+ # contain the following unusual line in --help:
43
+ # "(-h) --help show this help (-h is --help only if used alone)"
44
+ compgen -W ' $(
45
+ "$1" --help 2>&1 | sed -e "s/^([^)]*)//" | _parse_help -)
46
+ --daemon --old-d{,irs}
47
+ --no-{blocking-io,detach,whole-file,inc-recursive,i-r}' -X ' --no-OPTION' -- " $cur "
48
+ ) )
66
49
[[ ${COMPREPLY-} == * = ]] || compopt +o nospace
67
50
;;
68
51
* :* )
0 commit comments