'*--cacert[`file` to load root certificates from (default: use system certificates)]:'\
'--cache-dir[set the cache `directory`. (default: use system default cache directory)]:'\
'--cleanup-cache[auto remove old cache directories]'\
'(-h --help)'{-h,--help}'[help for restic]'\
'--json[set output mode to JSON for commands that support it]'\
'--key-hint[`key` ID of key to try decrypting first (default: $RESTIC_KEY_HINT)]:'\
'--limit-download[limits downloads to a maximum rate in KiB/s. (default: unlimited)]:'\
'--limit-upload[limits uploads to a maximum rate in KiB/s. (default: unlimited)]:'\
'--no-cache[do not use a local cache]'\
'--no-lock[do not lock the repo, this allows some operations on read-only repos]'\
'(*-o *--option)'{\*-o,\*--option}'[set extended option (`key=value`, can be specified multiple times)]:'\
'--password-command[shell `command` to obtain the repository password from (default: $RESTIC_PASSWORD_COMMAND)]:'\
'(-p --password-file)'{-p,--password-file}'[`file` to read the repository password from (default: $RESTIC_PASSWORD_FILE)]:'\
'(-q --quiet)'{-q,--quiet}'[do not output comprehensive progress report]'\
'(-r --repo)'{-r,--repo}'[`repository` to backup to or restore from (default: $RESTIC_REPOSITORY)]:'\
'--tls-client-cert[path to a `file` containing PEM encoded TLS client certificate and private key]:'\
'(-v --verbose)'{-v,--verbose}'[be verbose (specify --verbose multiple times or level --verbose=`n`)]'\
"1: :->cmnds"\
"*::arg:->args"
case$state in
cmnds)
commands=(
"backup:Create a new backup of files and/or directories"
"cache:Operate on local cache directories"
"cat:Print internal objects to stdout"
"check:Check the repository for errors"
"copy:Copy snapshots from one repository to another"
"diff:Show differences between two snapshots"
"dump:Print a backed-up file to stdout"
"find:Find a file, a directory or restic IDs"
"forget:Remove snapshots from the repository"
"generate:Generate manual pages and auto-completion files (bash, zsh)"
"help:Help about any command"
"init:Initialize a new repository"
"key:Manage keys (passwords)"
"list:List objects in the repository"
"ls:List files in a snapshot"
"migrate:Apply migrations"
"mount:Mount the repository"
"prune:Remove unneeded data from the repository"
"rebuild-index:Build a new index file"
"recover:Recover data from the repository"
"restore:Extract the data from a snapshot"
"self-update:Update the restic binary"
"snapshots:List all snapshots"
"stats:Scan the repository and show basic statistics"
"tag:Modify tags on snapshots"
"unlock:Remove locks other processes created"
"version:Print version information"
)
_describe "command" commands
;;
esac
case"$words[1]" in
backup)
_restic_backup
;;
cache)
_restic_cache
;;
cat)
_restic_cat
;;
check)
_restic_check
;;
copy)
_restic_copy
;;
diff)
_restic_diff
;;
dump)
_restic_dump
;;
find)
_restic_find
;;
forget)
_restic_forget
;;
generate)
_restic_generate
;;
help)
_restic_help
;;
init)
_restic_init
;;
key)
_restic_key
;;
list)
_restic_list
;;
ls)
_restic_ls
;;
migrate)
_restic_migrate
;;
mount)
_restic_mount
;;
prune)
_restic_prune
;;
rebuild-index)
_restic_rebuild-index
;;
recover)
_restic_recover
;;
restore)
_restic_restore
;;
self-update)
_restic_self-update
;;
snapshots)
_restic_snapshots
;;
stats)
_restic_stats
;;
tag)
_restic_tag
;;
unlock)
_restic_unlock
;;
version)
_restic_version
;;
esac
}
function _restic_backup {
_arguments \
'(*-e *--exclude)'{\*-e,\*--exclude}'[exclude a `pattern` (can be specified multiple times)]:'\
'--exclude-caches[excludes cache directories that are marked with a CACHEDIR.TAG file. See https://bford.info/cachedir/ for the Cache Directory Tagging Standard]'\
'*--exclude-file[read exclude patterns from a `file` (can be specified multiple times)]:'\
'*--exclude-if-present[takes `filename[:header]`, exclude contents of directories containing filename (except filename itself) if header of that file is as provided (can be specified multiple times)]:'\
'--exclude-larger-than[max `size` of the files to be backed up (allowed suffixes: k/K, m/M, g/G, t/T)]:'\
'*--files-from[read the files to backup from `file` (can be combined with file args/can be specified multiple times)]:'\
'(-f --force)'{-f,--force}'[force re-reading the target files/directories (overrides the "parent" flag)]'\
'(-h --help)'{-h,--help}'[help for backup]'\
'(-H --host)'{-H,--host}'[set the `hostname` for the snapshot manually. To prevent an expensive rescan use the "parent" flag]:'\
'*--iexclude[same as --exclude `pattern` but ignores the casing of filenames]:'\
'*--iexclude-file[same as --exclude-file but ignores casing of `file`names in patterns]:'\
'--ignore-inode[ignore inode number changes when checking for modified files]'\
'(-x --one-file-system)'{-x,--one-file-system}'[exclude other file systems]'\
'--parent[use this parent `snapshot` (default: last snapshot in the repo that has the same target files/directories)]:'\
'--stdin[read backup from stdin]'\
'--stdin-filename[`filename` to use when reading from stdin]:'\
'*--tag[add a `tag` for the new snapshot (can be specified multiple times)]:'\
'--time[`time` of the backup (ex. '\''2012-11-01 22:08:41'\'') (default: now)]:'\
'--with-atime[store the atime for all files and directories]'\
'*--cacert[`file` to load root certificates from (default: use system certificates)]:'\
'--cache-dir[set the cache `directory`. (default: use system default cache directory)]:'\
'--cleanup-cache[auto remove old cache directories]'\
'--json[set output mode to JSON for commands that support it]'\
'--key-hint[`key` ID of key to try decrypting first (default: $RESTIC_KEY_HINT)]:'\
'--limit-download[limits downloads to a maximum rate in KiB/s. (default: unlimited)]:'\
'--limit-upload[limits uploads to a maximum rate in KiB/s. (default: unlimited)]:'\
'--no-cache[do not use a local cache]'\
'--no-lock[do not lock the repo, this allows some operations on read-only repos]'\
'(*-o *--option)'{\*-o,\*--option}'[set extended option (`key=value`, can be specified multiple times)]:'\
'--password-command[shell `command` to obtain the repository password from (default: $RESTIC_PASSWORD_COMMAND)]:'\
'(-p --password-file)'{-p,--password-file}'[`file` to read the repository password from (default: $RESTIC_PASSWORD_FILE)]:'\
'(-q --quiet)'{-q,--quiet}'[do not output comprehensive progress report]'\
'(-r --repo)'{-r,--repo}'[`repository` to backup to or restore from (default: $RESTIC_REPOSITORY)]:'\
'--tls-client-cert[path to a `file` containing PEM encoded TLS client certificate and private key]:'\
'(-v --verbose)'{-v,--verbose}'[be verbose (specify --verbose multiple times or level --verbose=`n`)]'
}
function _restic_cache {
_arguments \
'--cleanup[remove old cache directories]'\
'(-h --help)'{-h,--help}'[help for cache]'\
'--max-age[max age in `days` for cache directories to be considered old]:'\
'--no-size[do not output the size of the cache directories]'\
'*--cacert[`file` to load root certificates from (default: use system certificates)]:'\
'--cache-dir[set the cache `directory`. (default: use system default cache directory)]:'\
'--cleanup-cache[auto remove old cache directories]'\
'--json[set output mode to JSON for commands that support it]'\
'--key-hint[`key` ID of key to try decrypting first (default: $RESTIC_KEY_HINT)]:'\
'--limit-download[limits downloads to a maximum rate in KiB/s. (default: unlimited)]:'\
'--limit-upload[limits uploads to a maximum rate in KiB/s. (default: unlimited)]:'\
'--no-cache[do not use a local cache]'\
'--no-lock[do not lock the repo, this allows some operations on read-only repos]'\
'(*-o *--option)'{\*-o,\*--option}'[set extended option (`key=value`, can be specified multiple times)]:'\
'--password-command[shell `command` to obtain the repository password from (default: $RESTIC_PASSWORD_COMMAND)]:'\
'(-p --password-file)'{-p,--password-file}'[`file` to read the repository password from (default: $RESTIC_PASSWORD_FILE)]:'\
'(-q --quiet)'{-q,--quiet}'[do not output comprehensive progress report]'\
'(-r --repo)'{-r,--repo}'[`repository` to backup to or restore from (default: $RESTIC_REPOSITORY)]:'\
'--tls-client-cert[path to a `file` containing PEM encoded TLS client certificate and private key]:'\
'(-v --verbose)'{-v,--verbose}'[be verbose (specify --verbose multiple times or level --verbose=`n`)]'
}
function _restic_cat {
_arguments \
'(-h --help)'{-h,--help}'[help for cat]'\
'*--cacert[`file` to load root certificates from (default: use system certificates)]:'\
'--cache-dir[set the cache `directory`. (default: use system default cache directory)]:'\
'--cleanup-cache[auto remove old cache directories]'\
'--json[set output mode to JSON for commands that support it]'\
'--key-hint[`key` ID of key to try decrypting first (default: $RESTIC_KEY_HINT)]:'\
'--limit-download[limits downloads to a maximum rate in KiB/s. (default: unlimited)]:'\
'--limit-upload[limits uploads to a maximum rate in KiB/s. (default: unlimited)]:'\
'--no-cache[do not use a local cache]'\
'--no-lock[do not lock the repo, this allows some operations on read-only repos]'\
'(*-o *--option)'{\*-o,\*--option}'[set extended option (`key=value`, can be specified multiple times)]:'\
'--password-command[shell `command` to obtain the repository password from (default: $RESTIC_PASSWORD_COMMAND)]:'\
'(-p --password-file)'{-p,--password-file}'[`file` to read the repository password from (default: $RESTIC_PASSWORD_FILE)]:'\
'(-q --quiet)'{-q,--quiet}'[do not output comprehensive progress report]'\
'(-r --repo)'{-r,--repo}'[`repository` to backup to or restore from (default: $RESTIC_REPOSITORY)]:'\
'--tls-client-cert[path to a `file` containing PEM encoded TLS client certificate and private key]:'\
'(-v --verbose)'{-v,--verbose}'[be verbose (specify --verbose multiple times or level --verbose=`n`)]'
}
function _restic_check {
_arguments \
'--check-unused[find unused blobs]'\
'(-h --help)'{-h,--help}'[help for check]'\
'--read-data[read all data blobs]'\
'--read-data-subset[read subset n of m data packs (format: `n/m`)]:'\
'--with-cache[use the cache]'\
'*--cacert[`file` to load root certificates from (default: use system certificates)]:'\
'--cache-dir[set the cache `directory`. (default: use system default cache directory)]:'\
'--cleanup-cache[auto remove old cache directories]'\
'--json[set output mode to JSON for commands that support it]'\
'--key-hint[`key` ID of key to try decrypting first (default: $RESTIC_KEY_HINT)]:'\
'--limit-download[limits downloads to a maximum rate in KiB/s. (default: unlimited)]:'\
'--limit-upload[limits uploads to a maximum rate in KiB/s. (default: unlimited)]:'\
'--no-cache[do not use a local cache]'\
'--no-lock[do not lock the repo, this allows some operations on read-only repos]'\
'(*-o *--option)'{\*-o,\*--option}'[set extended option (`key=value`, can be specified multiple times)]:'\
'--password-command[shell `command` to obtain the repository password from (default: $RESTIC_PASSWORD_COMMAND)]:'\
'(-p --password-file)'{-p,--password-file}'[`file` to read the repository password from (default: $RESTIC_PASSWORD_FILE)]:'\
'(-q --quiet)'{-q,--quiet}'[do not output comprehensive progress report]'\
'(-r --repo)'{-r,--repo}'[`repository` to backup to or restore from (default: $RESTIC_REPOSITORY)]:'\
'--tls-client-cert[path to a `file` containing PEM encoded TLS client certificate and private key]:'\
'(-v --verbose)'{-v,--verbose}'[be verbose (specify --verbose multiple times or level --verbose=`n`)]'
}
function _restic_copy {
_arguments \
'(-h --help)'{-h,--help}'[help for copy]'\
'(*-H *--host)'{\*-H,\*--host}'[only consider snapshots for this `host`, when no snapshot ID is given (can be specified multiple times)]:'\
'--key-hint2[key ID of key to try decrypting the destination repository first (default: $RESTIC_KEY_HINT2)]:'\
'--password-command2[shell `command` to obtain the destination repository password from (default: $RESTIC_PASSWORD_COMMAND2)]:'\
'--password-file2[`file` to read the destination repository password from (default: $RESTIC_PASSWORD_FILE2)]:'\
'*--path[only consider snapshots which include this (absolute) `path`, when no snapshot ID is given]:'\
'--repo2[destination repository to copy snapshots to (default: $RESTIC_REPOSITORY2)]:'\
'--tag[only consider snapshots which include this `taglist`, when no snapshot ID is given]:'\
'*--cacert[`file` to load root certificates from (default: use system certificates)]:'\
'--cache-dir[set the cache `directory`. (default: use system default cache directory)]:'\
'--cleanup-cache[auto remove old cache directories]'\
'--json[set output mode to JSON for commands that support it]'\
'--key-hint[`key` ID of key to try decrypting first (default: $RESTIC_KEY_HINT)]:'\
'--limit-download[limits downloads to a maximum rate in KiB/s. (default: unlimited)]:'\
'--limit-upload[limits uploads to a maximum rate in KiB/s. (default: unlimited)]:'\
'--no-cache[do not use a local cache]'\
'--no-lock[do not lock the repo, this allows some operations on read-only repos]'\
'(*-o *--option)'{\*-o,\*--option}'[set extended option (`key=value`, can be specified multiple times)]:'\
'--password-command[shell `command` to obtain the repository password from (default: $RESTIC_PASSWORD_COMMAND)]:'\
'(-p --password-file)'{-p,--password-file}'[`file` to read the repository password from (default: $RESTIC_PASSWORD_FILE)]:'\
'(-q --quiet)'{-q,--quiet}'[do not output comprehensive progress report]'\
'(-r --repo)'{-r,--repo}'[`repository` to backup to or restore from (default: $RESTIC_REPOSITORY)]:'\
'--tls-client-cert[path to a `file` containing PEM encoded TLS client certificate and private key]:'\
'(-v --verbose)'{-v,--verbose}'[be verbose (specify --verbose multiple times or level --verbose=`n`)]'
}
function _restic_diff {
_arguments \
'(-h --help)'{-h,--help}'[help for diff]'\
'--metadata[print changes in metadata]'\
'*--cacert[`file` to load root certificates from (default: use system certificates)]:'\
'--cache-dir[set the cache `directory`. (default: use system default cache directory)]:'\
'--cleanup-cache[auto remove old cache directories]'\
'--json[set output mode to JSON for commands that support it]'\
'--key-hint[`key` ID of key to try decrypting first (default: $RESTIC_KEY_HINT)]:'\
'--limit-download[limits downloads to a maximum rate in KiB/s. (default: unlimited)]:'\
'--limit-upload[limits uploads to a maximum rate in KiB/s. (default: unlimited)]:'\
'--no-cache[do not use a local cache]'\
'--no-lock[do not lock the repo, this allows some operations on read-only repos]'\
'(*-o *--option)'{\*-o,\*--option}'[set extended option (`key=value`, can be specified multiple times)]:'\
'--password-command[shell `command` to obtain the repository password from (default: $RESTIC_PASSWORD_COMMAND)]:'\
'(-p --password-file)'{-p,--password-file}'[`file` to read the repository password from (default: $RESTIC_PASSWORD_FILE)]:'\
'(-q --quiet)'{-q,--quiet}'[do not output comprehensive progress report]'\
'(-r --repo)'{-r,--repo}'[`repository` to backup to or restore from (default: $RESTIC_REPOSITORY)]:'\
'--tls-client-cert[path to a `file` containing PEM encoded TLS client certificate and private key]:'\
'(-v --verbose)'{-v,--verbose}'[be verbose (specify --verbose multiple times or level --verbose=`n`)]'
}
function _restic_dump {
_arguments \
'(-h --help)'{-h,--help}'[help for dump]'\
'(*-H *--host)'{\*-H,\*--host}'[only consider snapshots for this host when the snapshot ID is "latest" (can be specified multiple times)]:'\
'*--path[only consider snapshots which include this (absolute) `path` for snapshot ID "latest"]:'\
'--tag[only consider snapshots which include this `taglist` for snapshot ID "latest"]:'\
'*--cacert[`file` to load root certificates from (default: use system certificates)]:'\
'--cache-dir[set the cache `directory`. (default: use system default cache directory)]:'\
'--cleanup-cache[auto remove old cache directories]'\
'--json[set output mode to JSON for commands that support it]'\
'--key-hint[`key` ID of key to try decrypting first (default: $RESTIC_KEY_HINT)]:'\
'--limit-download[limits downloads to a maximum rate in KiB/s. (default: unlimited)]:'\
'--limit-upload[limits uploads to a maximum rate in KiB/s. (default: unlimited)]:'\
'--no-cache[do not use a local cache]'\
'--no-lock[do not lock the repo, this allows some operations on read-only repos]'\
'(*-o *--option)'{\*-o,\*--option}'[set extended option (`key=value`, can be specified multiple times)]:'\
'--password-command[shell `command` to obtain the repository password from (default: $RESTIC_PASSWORD_COMMAND)]:'\
'(-p --password-file)'{-p,--password-file}'[`file` to read the repository password from (default: $RESTIC_PASSWORD_FILE)]:'\
'(-q --quiet)'{-q,--quiet}'[do not output comprehensive progress report]'\
'(-r --repo)'{-r,--repo}'[`repository` to backup to or restore from (default: $RESTIC_REPOSITORY)]:'\
'--tls-client-cert[path to a `file` containing PEM encoded TLS client certificate and private key]:'\
'(-v --verbose)'{-v,--verbose}'[be verbose (specify --verbose multiple times or level --verbose=`n`)]'
}
function _restic_find {
_arguments \
'--blob[pattern is a blob-ID]'\
'(-h --help)'{-h,--help}'[help for find]'\
'(*-H *--host)'{\*-H,\*--host}'[only consider snapshots for this `host`, when no snapshot ID is given (can be specified multiple times)]:'\
'(-i --ignore-case)'{-i,--ignore-case}'[ignore case for pattern]'\
'(-l --long)'{-l,--long}'[use a long listing format showing size and mode]'\