rewrite tarsnap autocompletion based on PR review

This commit is contained in:
Daniel Teunis 2017-10-24 22:55:21 +02:00
parent 839f50f8a8
commit 70f69c15f9
1 changed files with 29 additions and 21 deletions

View File

@ -33,24 +33,32 @@
# #
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
_tarsnap() { _arguments \
local -a commands '(- 1 *)--help[prints tarsnap help]' \
commands=( '(- 1 *)--version[prints tarsnap version number]' \
'--fsck:Perform some integrity checks on the archives stored.' '(- 1 *)--verify-config[checks configuration files for syntactic errors]' \
'--fsck-prune:Run as "--fsck", but if corrupt archives are detected, prune the broken data.' '--fsck[performs integrity checks on the stored archives]' \
'--list-archives:Print the names of archives stored.' '--fsck-prune[performs integrity checks and prunes broken data]' \
'--nuke:Delete all of the archives stored.' '--list-archives[prints names of stored archives]' \
'--print-stats:Print global statistics concerning the archives stored.' '--nuke[deletes all stored archives]' \
'-c:Create an archive containing the specified items and name.' '--print-stats[prints archive statistics]' \
'-d:Delete the specified archive.' '--recover[recovers partial archive]' \
'-r:Read the specified archive, convert it to a tar stream, and write it to stdout.' '-c[creates archive]' \
'-t:List archive contents to stdout.' '-d[deletes specified archive]' \
'-x:Extract to disk from the archive.' '-r[prints content of specified archive]' \
) '-t[lists archive content]' \
'-x[extracts specified archive]' \
'--lowmem[reduces memory usage by not caching small files]' \
'--quiet[silences some warnings]' \
'--keyfile[specifies keyfile]:keyfile:->file' \
'--cachedir[specifies cache directory]:cachedir:->directory' \
'-f[specifies archive name]:archivename:->file'
if (( CURRENT == 2 )); then case "$state" in
_describe -t commands 'commands' commands file)
fi _files
;;
return 0 directory)
} _path_files -/
;;
esac