diff --git a/doc/bash-completion.sh b/doc/bash-completion.sh index d1685e566..9da58bec1 100644 --- a/doc/bash-completion.sh +++ b/doc/bash-completion.sh @@ -229,6 +229,14 @@ __restic_handle_word() __restic_handle_command elif [[ $c -eq 0 ]]; then __restic_handle_command + elif __restic_contains_word "${words[c]}" "${command_aliases[@]}"; then + # aliashash variable is an associative array which is only supported in bash > 3. + if [[ -z "${BASH_VERSION}" || "${BASH_VERSINFO[0]}" -gt 3 ]]; then + words[c]=${aliashash[${words[c]}]} + __restic_handle_command + else + __restic_handle_noun + fi else __restic_handle_noun fi @@ -238,6 +246,9 @@ __restic_handle_word() _restic_backup() { last_command="restic_backup" + + command_aliases=() + commands=() flags=() @@ -308,6 +319,9 @@ _restic_backup() _restic_cache() { last_command="restic_cache" + + command_aliases=() + commands=() flags=() @@ -351,6 +365,9 @@ _restic_cache() _restic_cat() { last_command="restic_cat" + + command_aliases=() + commands=() flags=() @@ -390,6 +407,9 @@ _restic_cat() _restic_check() { last_command="restic_check" + + command_aliases=() + commands=() flags=() @@ -437,6 +457,9 @@ _restic_check() _restic_diff() { last_command="restic_diff" + + command_aliases=() + commands=() flags=() @@ -478,6 +501,9 @@ _restic_diff() _restic_dump() { last_command="restic_dump" + + command_aliases=() + commands=() flags=() @@ -524,6 +550,9 @@ _restic_dump() _restic_find() { last_command="restic_find" + + command_aliases=() + commands=() flags=() @@ -585,6 +614,9 @@ _restic_find() _restic_forget() { last_command="restic_forget" + + command_aliases=() + commands=() flags=() @@ -665,6 +697,9 @@ _restic_forget() _restic_generate() { last_command="restic_generate" + + command_aliases=() + commands=() flags=() @@ -710,6 +745,9 @@ _restic_generate() _restic_init() { last_command="restic_init" + + command_aliases=() + commands=() flags=() @@ -749,6 +787,9 @@ _restic_init() _restic_key() { last_command="restic_key" + + command_aliases=() + commands=() flags=() @@ -790,6 +831,9 @@ _restic_key() _restic_list() { last_command="restic_list" + + command_aliases=() + commands=() flags=() @@ -829,6 +873,9 @@ _restic_list() _restic_ls() { last_command="restic_ls" + + command_aliases=() + commands=() flags=() @@ -878,6 +925,9 @@ _restic_ls() _restic_migrate() { last_command="restic_migrate" + + command_aliases=() + commands=() flags=() @@ -920,6 +970,9 @@ _restic_migrate() _restic_mount() { last_command="restic_mount" + + command_aliases=() + commands=() flags=() @@ -974,6 +1027,9 @@ _restic_mount() _restic_prune() { last_command="restic_prune" + + command_aliases=() + commands=() flags=() @@ -1013,6 +1069,9 @@ _restic_prune() _restic_rebuild-index() { last_command="restic_rebuild-index" + + command_aliases=() + commands=() flags=() @@ -1052,6 +1111,9 @@ _restic_rebuild-index() _restic_restore() { last_command="restic_restore" + + command_aliases=() + commands=() flags=() @@ -1079,6 +1141,8 @@ _restic_restore() flags+=("--target=") two_word_flags+=("-t") local_nonpersistent_flags+=("--target=") + flags+=("--verify") + local_nonpersistent_flags+=("--verify") flags+=("--cacert=") flags+=("--cache-dir=") flags+=("--cleanup-cache") @@ -1107,6 +1171,9 @@ _restic_restore() _restic_snapshots() { last_command="restic_snapshots" + + command_aliases=() + commands=() flags=() @@ -1155,9 +1222,58 @@ _restic_snapshots() noun_aliases=() } +_restic_stats() +{ + last_command="restic_stats" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--help") + flags+=("-h") + local_nonpersistent_flags+=("--help") + flags+=("--host=") + local_nonpersistent_flags+=("--host=") + flags+=("--mode=") + local_nonpersistent_flags+=("--mode=") + flags+=("--cacert=") + flags+=("--cache-dir=") + flags+=("--cleanup-cache") + flags+=("--json") + flags+=("--limit-download=") + flags+=("--limit-upload=") + flags+=("--no-cache") + flags+=("--no-lock") + flags+=("--option=") + two_word_flags+=("-o") + flags+=("--password-file=") + two_word_flags+=("-p") + flags+=("--quiet") + flags+=("-q") + flags+=("--repo=") + two_word_flags+=("-r") + flags+=("--tls-client-cert=") + flags+=("--verbose") + flags+=("-v") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + _restic_tag() { last_command="restic_tag" + + command_aliases=() + commands=() flags=() @@ -1210,6 +1326,9 @@ _restic_tag() _restic_unlock() { last_command="restic_unlock" + + command_aliases=() + commands=() flags=() @@ -1251,6 +1370,9 @@ _restic_unlock() _restic_version() { last_command="restic_version" + + command_aliases=() + commands=() flags=() @@ -1290,6 +1412,9 @@ _restic_version() _restic_root_command() { last_command="restic" + + command_aliases=() + commands=() commands+=("backup") commands+=("cache") @@ -1353,6 +1478,7 @@ __start_restic() { local cur prev words cword declare -A flaghash 2>/dev/null || : + declare -A aliashash 2>/dev/null || : if declare -F _init_completion >/dev/null 2>&1; then _init_completion -s || return else diff --git a/doc/man/restic-check.1 b/doc/man/restic-check.1 index d939fd6a8..e610396b5 100644 --- a/doc/man/restic-check.1 +++ b/doc/man/restic-check.1 @@ -38,7 +38,7 @@ repository and not use a local cache. .PP \fB\-\-read\-data\-subset\fP="" - read subset of data packs + read subset n of m data packs (format: \fB\fCn/m\fR) .PP \fB\-\-with\-cache\fP[=false] diff --git a/doc/man/restic-restore.1 b/doc/man/restic-restore.1 index 8562d9f2f..d21e58f27 100644 --- a/doc/man/restic-restore.1 +++ b/doc/man/restic-restore.1 @@ -52,6 +52,10 @@ repository. \fB\-t\fP, \fB\-\-target\fP="" directory to extract data to +.PP +\fB\-\-verify\fP[=false] + verify restored files content + .SH OPTIONS INHERITED FROM PARENT COMMANDS .PP diff --git a/doc/man/restic-stats.1 b/doc/man/restic-stats.1 new file mode 100644 index 000000000..53400e689 --- /dev/null +++ b/doc/man/restic-stats.1 @@ -0,0 +1,124 @@ +.TH "restic backup" "1" "Jan 2017" "generated by `restic generate`" "" +.nh +.ad l + + +.SH NAME +.PP +restic\-stats \- Scan the repository and show basic statistics + + +.SH SYNOPSIS +.PP +\fBrestic stats [flags] [snapshot\-ID]\fP + + +.SH DESCRIPTION +.PP +The "stats" command walks one or all snapshots in a repository and +accumulates statistics about the data stored therein. It reports on +the number of unique files and their sizes, according to one of +the counting modes as given by the \-\-mode flag. + +.PP +If no snapshot is specified, all snapshots will be considered. Some +modes make more sense over just a single snapshot, while others +are useful across all snapshots, depending on what you are trying +to calculate. + +.PP +The modes are: + +.PP +restore\-size: (default) Counts the size of the restored files. + +.PP +files\-by\-contents: Counts total size of files, where a file is + considered unique if it has unique contents. + +.PP +raw\-data: Counts the size of blobs in the repository, regardless + of how many files reference them. + +.PP +blobs\-per\-file: A combination of files\-by\-contents and raw\-data. + +.PP +Refer to the online manual for more details about each mode. + + +.SH OPTIONS +.PP +\fB\-h\fP, \fB\-\-help\fP[=false] + help for stats + +.PP +\fB\-\-host\fP="" + filter latest snapshot by this hostname + +.PP +\fB\-\-mode\fP="restore\-size" + counting mode: restore\-size (default), files\-by\-contents, blobs\-per\-file, or raw\-data + + +.SH OPTIONS INHERITED FROM PARENT COMMANDS +.PP +\fB\-\-cacert\fP=[] + \fB\fCfile\fR to load root certificates from (default: use system certificates) + +.PP +\fB\-\-cache\-dir\fP="" + set the cache directory + +.PP +\fB\-\-cleanup\-cache\fP[=false] + auto remove old cache directories + +.PP +\fB\-\-json\fP[=false] + set output mode to JSON for commands that support it + +.PP +\fB\-\-limit\-download\fP=0 + limits downloads to a maximum rate in KiB/s. (default: unlimited) + +.PP +\fB\-\-limit\-upload\fP=0 + limits uploads to a maximum rate in KiB/s. (default: unlimited) + +.PP +\fB\-\-no\-cache\fP[=false] + do not use a local cache + +.PP +\fB\-\-no\-lock\fP[=false] + do not lock the repo, this allows some operations on read\-only repos + +.PP +\fB\-o\fP, \fB\-\-option\fP=[] + set extended option (\fB\fCkey=value\fR, can be specified multiple times) + +.PP +\fB\-p\fP, \fB\-\-password\-file\fP="" + read the repository password from a file (default: $RESTIC\_PASSWORD\_FILE) + +.PP +\fB\-q\fP, \fB\-\-quiet\fP[=false] + do not output comprehensive progress report + +.PP +\fB\-r\fP, \fB\-\-repo\fP="" + repository to backup to or restore from (default: $RESTIC\_REPOSITORY) + +.PP +\fB\-\-tls\-client\-cert\fP="" + path to a file containing PEM encoded TLS client certificate and private key + +.PP +\fB\-v\fP, \fB\-\-verbose\fP[=0] + be verbose (specify \-\-verbose multiple times or level \fB\fCn\fR) + + +.SH SEE ALSO +.PP +\fBrestic(1)\fP diff --git a/doc/man/restic.1 b/doc/man/restic.1 index 4a8e7ff01..30180b3ea 100644 --- a/doc/man/restic.1 +++ b/doc/man/restic.1 @@ -83,4 +83,4 @@ directories in an encrypted repository stored on different backends. .SH SEE ALSO .PP -\fBrestic\-backup(1)\fP, \fBrestic\-cache(1)\fP, \fBrestic\-cat(1)\fP, \fBrestic\-check(1)\fP, \fBrestic\-diff(1)\fP, \fBrestic\-dump(1)\fP, \fBrestic\-find(1)\fP, \fBrestic\-forget(1)\fP, \fBrestic\-generate(1)\fP, \fBrestic\-init(1)\fP, \fBrestic\-key(1)\fP, \fBrestic\-list(1)\fP, \fBrestic\-ls(1)\fP, \fBrestic\-migrate(1)\fP, \fBrestic\-mount(1)\fP, \fBrestic\-prune(1)\fP, \fBrestic\-rebuild\-index(1)\fP, \fBrestic\-restore(1)\fP, \fBrestic\-snapshots(1)\fP, \fBrestic\-tag(1)\fP, \fBrestic\-unlock(1)\fP, \fBrestic\-version(1)\fP +\fBrestic\-backup(1)\fP, \fBrestic\-cache(1)\fP, \fBrestic\-cat(1)\fP, \fBrestic\-check(1)\fP, \fBrestic\-diff(1)\fP, \fBrestic\-dump(1)\fP, \fBrestic\-find(1)\fP, \fBrestic\-forget(1)\fP, \fBrestic\-generate(1)\fP, \fBrestic\-init(1)\fP, \fBrestic\-key(1)\fP, \fBrestic\-list(1)\fP, \fBrestic\-ls(1)\fP, \fBrestic\-migrate(1)\fP, \fBrestic\-mount(1)\fP, \fBrestic\-prune(1)\fP, \fBrestic\-rebuild\-index(1)\fP, \fBrestic\-restore(1)\fP, \fBrestic\-snapshots(1)\fP, \fBrestic\-stats(1)\fP, \fBrestic\-tag(1)\fP, \fBrestic\-unlock(1)\fP, \fBrestic\-version(1)\fP diff --git a/doc/zsh-completion.zsh b/doc/zsh-completion.zsh index 740d1c9d7..4ce5d1620 100644 --- a/doc/zsh-completion.zsh +++ b/doc/zsh-completion.zsh @@ -7,7 +7,7 @@ case $state in level1) case $words[1] in restic) - _arguments '1: :(backup cache cat check diff dump find forget generate help init key list ls migrate mount options prune rebuild-index restore snapshots tag unlock version)' + _arguments '1: :(backup cache cat check diff dump find forget generate help init key list ls migrate mount options prune rebuild-index restore snapshots stats tag unlock version)' ;; *) _arguments '*: :_files'