Update manpages and auto-completion

This commit is contained in:
Alexander Neumann 2023-01-12 20:51:19 +01:00
parent 099774c2aa
commit da196aa43e
30 changed files with 664 additions and 138 deletions

View file

@ -436,6 +436,8 @@ _restic_backup()
local_nonpersistent_flags+=("--ignore-ctime") local_nonpersistent_flags+=("--ignore-ctime")
flags+=("--ignore-inode") flags+=("--ignore-inode")
local_nonpersistent_flags+=("--ignore-inode") local_nonpersistent_flags+=("--ignore-inode")
flags+=("--no-scan")
local_nonpersistent_flags+=("--no-scan")
flags+=("--one-file-system") flags+=("--one-file-system")
flags+=("-x") flags+=("-x")
local_nonpersistent_flags+=("--one-file-system") local_nonpersistent_flags+=("--one-file-system")
@ -444,6 +446,10 @@ _restic_backup()
two_word_flags+=("--parent") two_word_flags+=("--parent")
local_nonpersistent_flags+=("--parent") local_nonpersistent_flags+=("--parent")
local_nonpersistent_flags+=("--parent=") local_nonpersistent_flags+=("--parent=")
flags+=("--read-concurrency=")
two_word_flags+=("--read-concurrency")
local_nonpersistent_flags+=("--read-concurrency")
local_nonpersistent_flags+=("--read-concurrency=")
flags+=("--stdin") flags+=("--stdin")
local_nonpersistent_flags+=("--stdin") local_nonpersistent_flags+=("--stdin")
flags+=("--stdin-filename=") flags+=("--stdin-filename=")
@ -1256,6 +1262,10 @@ _restic_generate()
two_word_flags+=("--man") two_word_flags+=("--man")
local_nonpersistent_flags+=("--man") local_nonpersistent_flags+=("--man")
local_nonpersistent_flags+=("--man=") local_nonpersistent_flags+=("--man=")
flags+=("--powershell-completion=")
two_word_flags+=("--powershell-completion")
local_nonpersistent_flags+=("--powershell-completion")
local_nonpersistent_flags+=("--powershell-completion=")
flags+=("--zsh-completion=") flags+=("--zsh-completion=")
two_word_flags+=("--zsh-completion") two_word_flags+=("--zsh-completion")
local_nonpersistent_flags+=("--zsh-completion") local_nonpersistent_flags+=("--zsh-completion")
@ -2083,6 +2093,8 @@ _restic_restore()
two_word_flags+=("--path") two_word_flags+=("--path")
local_nonpersistent_flags+=("--path") local_nonpersistent_flags+=("--path")
local_nonpersistent_flags+=("--path=") local_nonpersistent_flags+=("--path=")
flags+=("--sparse")
local_nonpersistent_flags+=("--sparse")
flags+=("--tag=") flags+=("--tag=")
two_word_flags+=("--tag") two_word_flags+=("--tag")
local_nonpersistent_flags+=("--tag") local_nonpersistent_flags+=("--tag")
@ -2139,6 +2151,106 @@ _restic_restore()
noun_aliases=() noun_aliases=()
} }
_restic_rewrite()
{
last_command="restic_rewrite"
command_aliases=()
commands=()
flags=()
two_word_flags=()
local_nonpersistent_flags=()
flags_with_completion=()
flags_completion=()
flags+=("--dry-run")
flags+=("-n")
local_nonpersistent_flags+=("--dry-run")
local_nonpersistent_flags+=("-n")
flags+=("--exclude=")
two_word_flags+=("--exclude")
two_word_flags+=("-e")
local_nonpersistent_flags+=("--exclude")
local_nonpersistent_flags+=("--exclude=")
local_nonpersistent_flags+=("-e")
flags+=("--exclude-file=")
two_word_flags+=("--exclude-file")
local_nonpersistent_flags+=("--exclude-file")
local_nonpersistent_flags+=("--exclude-file=")
flags+=("--forget")
local_nonpersistent_flags+=("--forget")
flags+=("--help")
flags+=("-h")
local_nonpersistent_flags+=("--help")
local_nonpersistent_flags+=("-h")
flags+=("--host=")
two_word_flags+=("--host")
two_word_flags+=("-H")
local_nonpersistent_flags+=("--host")
local_nonpersistent_flags+=("--host=")
local_nonpersistent_flags+=("-H")
flags+=("--iexclude=")
two_word_flags+=("--iexclude")
local_nonpersistent_flags+=("--iexclude")
local_nonpersistent_flags+=("--iexclude=")
flags+=("--iexclude-file=")
two_word_flags+=("--iexclude-file")
local_nonpersistent_flags+=("--iexclude-file")
local_nonpersistent_flags+=("--iexclude-file=")
flags+=("--path=")
two_word_flags+=("--path")
local_nonpersistent_flags+=("--path")
local_nonpersistent_flags+=("--path=")
flags+=("--tag=")
two_word_flags+=("--tag")
local_nonpersistent_flags+=("--tag")
local_nonpersistent_flags+=("--tag=")
flags+=("--cacert=")
two_word_flags+=("--cacert")
flags+=("--cache-dir=")
two_word_flags+=("--cache-dir")
flags+=("--cleanup-cache")
flags+=("--compression=")
two_word_flags+=("--compression")
flags+=("--insecure-tls")
flags+=("--json")
flags+=("--key-hint=")
two_word_flags+=("--key-hint")
flags+=("--limit-download=")
two_word_flags+=("--limit-download")
flags+=("--limit-upload=")
two_word_flags+=("--limit-upload")
flags+=("--no-cache")
flags+=("--no-lock")
flags+=("--option=")
two_word_flags+=("--option")
two_word_flags+=("-o")
flags+=("--pack-size=")
two_word_flags+=("--pack-size")
flags+=("--password-command=")
two_word_flags+=("--password-command")
flags+=("--password-file=")
two_word_flags+=("--password-file")
two_word_flags+=("-p")
flags+=("--quiet")
flags+=("-q")
flags+=("--repo=")
two_word_flags+=("--repo")
two_word_flags+=("-r")
flags+=("--repository-file=")
two_word_flags+=("--repository-file")
flags+=("--tls-client-cert=")
two_word_flags+=("--tls-client-cert")
flags+=("--verbose")
flags+=("-v")
must_have_one_flag=()
must_have_one_noun=()
noun_aliases=()
}
_restic_self-update() _restic_self-update()
{ {
last_command="restic_self-update" last_command="restic_self-update"
@ -2617,6 +2729,7 @@ _restic_root_command()
commands+=("rebuild-index") commands+=("rebuild-index")
commands+=("recover") commands+=("recover")
commands+=("restore") commands+=("restore")
commands+=("rewrite")
commands+=("self-update") commands+=("self-update")
commands+=("snapshots") commands+=("snapshots")
commands+=("stats") commands+=("stats")

View file

@ -89,6 +89,10 @@ Exit status is 3 if some source data could not be read (incomplete snapshot crea
\fB--ignore-inode\fP[=false] \fB--ignore-inode\fP[=false]
ignore inode number changes when checking for modified files ignore inode number changes when checking for modified files
.PP
\fB--no-scan\fP[=false]
do not run scanner to estimate size of backup
.PP .PP
\fB-x\fP, \fB--one-file-system\fP[=false] \fB-x\fP, \fB--one-file-system\fP[=false]
exclude other file systems, don't cross filesystem boundaries and subvolumes exclude other file systems, don't cross filesystem boundaries and subvolumes
@ -97,6 +101,10 @@ Exit status is 3 if some source data could not be read (incomplete snapshot crea
\fB--parent\fP="" \fB--parent\fP=""
use this parent \fB\fCsnapshot\fR (default: last snapshot in the repository that has the same target files/directories, and is not newer than the snapshot time) use this parent \fB\fCsnapshot\fR (default: last snapshot in the repository that has the same target files/directories, and is not newer than the snapshot time)
.PP
\fB--read-concurrency\fP=0
read \fB\fCn\fR files concurrently (default: $RESTIC_READ_CONCURRENCY or 2)
.PP .PP
\fB--stdin\fP[=false] \fB--stdin\fP[=false]
read backup from stdin read backup from stdin
@ -149,11 +157,11 @@ Exit status is 3 if some source data could not be read (incomplete snapshot crea
.PP .PP
\fB--limit-download\fP=0 \fB--limit-download\fP=0
limits downloads to a maximum rate in KiB/s. (default: unlimited) limits downloads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--limit-upload\fP=0 \fB--limit-upload\fP=0
limits uploads to a maximum rate in KiB/s. (default: unlimited) limits uploads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--no-cache\fP[=false] \fB--no-cache\fP[=false]
@ -169,7 +177,7 @@ Exit status is 3 if some source data could not be read (incomplete snapshot crea
.PP .PP
\fB--pack-size\fP=0 \fB--pack-size\fP=0
set target pack size in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE) set target pack \fB\fCsize\fR in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE)
.PP .PP
\fB--password-command\fP="" \fB--password-command\fP=""
@ -197,7 +205,7 @@ Exit status is 3 if some source data could not be read (incomplete snapshot crea
.PP .PP
\fB-v\fP, \fB--verbose\fP[=0] \fB-v\fP, \fB--verbose\fP[=0]
be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 3) be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 2)
.SH SEE ALSO .SH SEE ALSO

View file

@ -70,11 +70,11 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--limit-download\fP=0 \fB--limit-download\fP=0
limits downloads to a maximum rate in KiB/s. (default: unlimited) limits downloads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--limit-upload\fP=0 \fB--limit-upload\fP=0
limits uploads to a maximum rate in KiB/s. (default: unlimited) limits uploads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--no-cache\fP[=false] \fB--no-cache\fP[=false]
@ -90,7 +90,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--pack-size\fP=0 \fB--pack-size\fP=0
set target pack size in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE) set target pack \fB\fCsize\fR in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE)
.PP .PP
\fB--password-command\fP="" \fB--password-command\fP=""
@ -118,7 +118,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB-v\fP, \fB--verbose\fP[=0] \fB-v\fP, \fB--verbose\fP[=0]
be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 3) be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 2)
.SH SEE ALSO .SH SEE ALSO

View file

@ -58,11 +58,11 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--limit-download\fP=0 \fB--limit-download\fP=0
limits downloads to a maximum rate in KiB/s. (default: unlimited) limits downloads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--limit-upload\fP=0 \fB--limit-upload\fP=0
limits uploads to a maximum rate in KiB/s. (default: unlimited) limits uploads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--no-cache\fP[=false] \fB--no-cache\fP[=false]
@ -78,7 +78,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--pack-size\fP=0 \fB--pack-size\fP=0
set target pack size in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE) set target pack \fB\fCsize\fR in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE)
.PP .PP
\fB--password-command\fP="" \fB--password-command\fP=""
@ -106,7 +106,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB-v\fP, \fB--verbose\fP[=0] \fB-v\fP, \fB--verbose\fP[=0]
be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 3) be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 2)
.SH SEE ALSO .SH SEE ALSO

View file

@ -75,11 +75,11 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--limit-download\fP=0 \fB--limit-download\fP=0
limits downloads to a maximum rate in KiB/s. (default: unlimited) limits downloads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--limit-upload\fP=0 \fB--limit-upload\fP=0
limits uploads to a maximum rate in KiB/s. (default: unlimited) limits uploads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--no-cache\fP[=false] \fB--no-cache\fP[=false]
@ -95,7 +95,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--pack-size\fP=0 \fB--pack-size\fP=0
set target pack size in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE) set target pack \fB\fCsize\fR in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE)
.PP .PP
\fB--password-command\fP="" \fB--password-command\fP=""
@ -123,7 +123,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB-v\fP, \fB--verbose\fP[=0] \fB-v\fP, \fB--verbose\fP[=0]
be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 3) be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 2)
.SH SEE ALSO .SH SEE ALSO

View file

@ -57,15 +57,15 @@ new destination repository using the "init" command.
.PP .PP
\fB-H\fP, \fB--host\fP=[] \fB-H\fP, \fB--host\fP=[]
only consider snapshots for this \fB\fChost\fR, when no snapshot ID is given (can be specified multiple times) only consider snapshots for this \fB\fChost\fR (can be specified multiple times)
.PP .PP
\fB--path\fP=[] \fB--path\fP=[]
only consider snapshots which include this (absolute) \fB\fCpath\fR, when no snapshot ID is given only consider snapshots including this (absolute) \fB\fCpath\fR (can be specified multiple times)
.PP .PP
\fB--tag\fP=[] \fB--tag\fP=[]
only consider snapshots which include this \fB\fCtaglist\fR, when no snapshot ID is given only consider snapshots including \fB\fCtag[,tag,...]\fR (can be specified multiple times)
.SH OPTIONS INHERITED FROM PARENT COMMANDS .SH OPTIONS INHERITED FROM PARENT COMMANDS
@ -99,11 +99,11 @@ new destination repository using the "init" command.
.PP .PP
\fB--limit-download\fP=0 \fB--limit-download\fP=0
limits downloads to a maximum rate in KiB/s. (default: unlimited) limits downloads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--limit-upload\fP=0 \fB--limit-upload\fP=0
limits uploads to a maximum rate in KiB/s. (default: unlimited) limits uploads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--no-cache\fP[=false] \fB--no-cache\fP[=false]
@ -119,7 +119,7 @@ new destination repository using the "init" command.
.PP .PP
\fB--pack-size\fP=0 \fB--pack-size\fP=0
set target pack size in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE) set target pack \fB\fCsize\fR in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE)
.PP .PP
\fB--password-command\fP="" \fB--password-command\fP=""
@ -147,7 +147,7 @@ new destination repository using the "init" command.
.PP .PP
\fB-v\fP, \fB--verbose\fP[=0] \fB-v\fP, \fB--verbose\fP[=0]
be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 3) be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 2)
.SH SEE ALSO .SH SEE ALSO

View file

@ -78,11 +78,11 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--limit-download\fP=0 \fB--limit-download\fP=0
limits downloads to a maximum rate in KiB/s. (default: unlimited) limits downloads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--limit-upload\fP=0 \fB--limit-upload\fP=0
limits uploads to a maximum rate in KiB/s. (default: unlimited) limits uploads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--no-cache\fP[=false] \fB--no-cache\fP[=false]
@ -98,7 +98,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--pack-size\fP=0 \fB--pack-size\fP=0
set target pack size in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE) set target pack \fB\fCsize\fR in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE)
.PP .PP
\fB--password-command\fP="" \fB--password-command\fP=""
@ -126,7 +126,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB-v\fP, \fB--verbose\fP[=0] \fB-v\fP, \fB--verbose\fP[=0]
be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 3) be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 2)
.SH SEE ALSO .SH SEE ALSO

View file

@ -39,15 +39,15 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB-H\fP, \fB--host\fP=[] \fB-H\fP, \fB--host\fP=[]
only consider snapshots for this host when the snapshot ID is "latest" (can be specified multiple times) only consider snapshots for this \fB\fChost\fR, when snapshot ID "latest" is given (can be specified multiple times)
.PP .PP
\fB--path\fP=[] \fB--path\fP=[]
only consider snapshots which include this (absolute) \fB\fCpath\fR for snapshot ID "latest" only consider snapshots including this (absolute) \fB\fCpath\fR, when snapshot ID "latest" is given (can be specified multiple times)
.PP .PP
\fB--tag\fP=[] \fB--tag\fP=[]
only consider snapshots which include this \fB\fCtaglist\fR for snapshot ID "latest" only consider snapshots including \fB\fCtag[,tag,...]\fR, when snapshot ID "latest" is given (can be specified multiple times)
.SH OPTIONS INHERITED FROM PARENT COMMANDS .SH OPTIONS INHERITED FROM PARENT COMMANDS
@ -81,11 +81,11 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--limit-download\fP=0 \fB--limit-download\fP=0
limits downloads to a maximum rate in KiB/s. (default: unlimited) limits downloads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--limit-upload\fP=0 \fB--limit-upload\fP=0
limits uploads to a maximum rate in KiB/s. (default: unlimited) limits uploads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--no-cache\fP[=false] \fB--no-cache\fP[=false]
@ -101,7 +101,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--pack-size\fP=0 \fB--pack-size\fP=0
set target pack size in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE) set target pack \fB\fCsize\fR in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE)
.PP .PP
\fB--password-command\fP="" \fB--password-command\fP=""
@ -129,7 +129,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB-v\fP, \fB--verbose\fP[=0] \fB-v\fP, \fB--verbose\fP[=0]
be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 3) be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 2)
.SH SEE ALSO .SH SEE ALSO

View file

@ -29,7 +29,7 @@ It can also be used to search for restic blobs or trees for troubleshooting.
.PP .PP
\fB-H\fP, \fB--host\fP=[] \fB-H\fP, \fB--host\fP=[]
only consider snapshots for this \fB\fChost\fR, when no snapshot ID is given (can be specified multiple times) only consider snapshots for this \fB\fChost\fR (can be specified multiple times)
.PP .PP
\fB-i\fP, \fB--ignore-case\fP[=false] \fB-i\fP, \fB--ignore-case\fP[=false]
@ -53,7 +53,7 @@ It can also be used to search for restic blobs or trees for troubleshooting.
.PP .PP
\fB--path\fP=[] \fB--path\fP=[]
only consider snapshots which include this (absolute) \fB\fCpath\fR, when no snapshot-ID is given only consider snapshots including this (absolute) \fB\fCpath\fR (can be specified multiple times)
.PP .PP
\fB--show-pack-id\fP[=false] \fB--show-pack-id\fP[=false]
@ -65,7 +65,7 @@ It can also be used to search for restic blobs or trees for troubleshooting.
.PP .PP
\fB--tag\fP=[] \fB--tag\fP=[]
only consider snapshots which include this \fB\fCtaglist\fR, when no snapshot-ID is given only consider snapshots including \fB\fCtag[,tag,...]\fR (can be specified multiple times)
.PP .PP
\fB--tree\fP[=false] \fB--tree\fP[=false]
@ -103,11 +103,11 @@ It can also be used to search for restic blobs or trees for troubleshooting.
.PP .PP
\fB--limit-download\fP=0 \fB--limit-download\fP=0
limits downloads to a maximum rate in KiB/s. (default: unlimited) limits downloads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--limit-upload\fP=0 \fB--limit-upload\fP=0
limits uploads to a maximum rate in KiB/s. (default: unlimited) limits uploads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--no-cache\fP[=false] \fB--no-cache\fP[=false]
@ -123,7 +123,7 @@ It can also be used to search for restic blobs or trees for troubleshooting.
.PP .PP
\fB--pack-size\fP=0 \fB--pack-size\fP=0
set target pack size in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE) set target pack \fB\fCsize\fR in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE)
.PP .PP
\fB--password-command\fP="" \fB--password-command\fP=""
@ -151,7 +151,7 @@ It can also be used to search for restic blobs or trees for troubleshooting.
.PP .PP
\fB-v\fP, \fB--verbose\fP[=0] \fB-v\fP, \fB--verbose\fP[=0]
be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 3) be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 2)
.SH EXAMPLE .SH EXAMPLE

View file

@ -87,15 +87,15 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--host\fP=[] \fB--host\fP=[]
only consider snapshots with the given \fB\fChost\fR (can be specified multiple times) only consider snapshots for this \fB\fChost\fR (can be specified multiple times)
.PP .PP
\fB--tag\fP=[] \fB--tag\fP=[]
only consider snapshots which include this \fB\fCtaglist\fR in the format \fB\fCtag[,tag,...]\fR (can be specified multiple times) only consider snapshots including \fB\fCtag[,tag,...]\fR (can be specified multiple times)
.PP .PP
\fB--path\fP=[] \fB--path\fP=[]
only consider snapshots which include this (absolute) \fB\fCpath\fR (can be specified multiple times) only consider snapshots including this (absolute) \fB\fCpath\fR (can be specified multiple times)
.PP .PP
\fB-c\fP, \fB--compact\fP[=false] \fB-c\fP, \fB--compact\fP[=false]
@ -169,11 +169,11 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--limit-download\fP=0 \fB--limit-download\fP=0
limits downloads to a maximum rate in KiB/s. (default: unlimited) limits downloads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--limit-upload\fP=0 \fB--limit-upload\fP=0
limits uploads to a maximum rate in KiB/s. (default: unlimited) limits uploads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--no-cache\fP[=false] \fB--no-cache\fP[=false]
@ -189,7 +189,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--pack-size\fP=0 \fB--pack-size\fP=0
set target pack size in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE) set target pack \fB\fCsize\fR in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE)
.PP .PP
\fB--password-command\fP="" \fB--password-command\fP=""
@ -217,7 +217,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB-v\fP, \fB--verbose\fP[=0] \fB-v\fP, \fB--verbose\fP[=0]
be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 3) be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 2)
.SH SEE ALSO .SH SEE ALSO

View file

@ -3,7 +3,7 @@
.SH NAME .SH NAME
.PP .PP
restic-generate - Generate manual pages and auto-completion files (bash, fish, zsh) restic-generate - Generate manual pages and auto-completion files (bash, fish, zsh, powershell)
.SH SYNOPSIS .SH SYNOPSIS
@ -39,6 +39,10 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
\fB--man\fP="" \fB--man\fP=""
write man pages to \fB\fCdirectory\fR write man pages to \fB\fCdirectory\fR
.PP
\fB--powershell-completion\fP=""
write powershell completion \fB\fCfile\fR
.PP .PP
\fB--zsh-completion\fP="" \fB--zsh-completion\fP=""
write zsh completion \fB\fCfile\fR write zsh completion \fB\fCfile\fR
@ -75,11 +79,11 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--limit-download\fP=0 \fB--limit-download\fP=0
limits downloads to a maximum rate in KiB/s. (default: unlimited) limits downloads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--limit-upload\fP=0 \fB--limit-upload\fP=0
limits uploads to a maximum rate in KiB/s. (default: unlimited) limits uploads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--no-cache\fP[=false] \fB--no-cache\fP[=false]
@ -95,7 +99,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--pack-size\fP=0 \fB--pack-size\fP=0
set target pack size in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE) set target pack \fB\fCsize\fR in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE)
.PP .PP
\fB--password-command\fP="" \fB--password-command\fP=""
@ -123,7 +127,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB-v\fP, \fB--verbose\fP[=0] \fB-v\fP, \fB--verbose\fP[=0]
be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 3) be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 2)
.SH SEE ALSO .SH SEE ALSO

View file

@ -86,11 +86,11 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--limit-download\fP=0 \fB--limit-download\fP=0
limits downloads to a maximum rate in KiB/s. (default: unlimited) limits downloads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--limit-upload\fP=0 \fB--limit-upload\fP=0
limits uploads to a maximum rate in KiB/s. (default: unlimited) limits uploads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--no-cache\fP[=false] \fB--no-cache\fP[=false]
@ -106,7 +106,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--pack-size\fP=0 \fB--pack-size\fP=0
set target pack size in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE) set target pack \fB\fCsize\fR in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE)
.PP .PP
\fB--password-command\fP="" \fB--password-command\fP=""
@ -134,7 +134,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB-v\fP, \fB--verbose\fP[=0] \fB-v\fP, \fB--verbose\fP[=0]
be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 3) be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 2)
.SH SEE ALSO .SH SEE ALSO

View file

@ -70,11 +70,11 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--limit-download\fP=0 \fB--limit-download\fP=0
limits downloads to a maximum rate in KiB/s. (default: unlimited) limits downloads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--limit-upload\fP=0 \fB--limit-upload\fP=0
limits uploads to a maximum rate in KiB/s. (default: unlimited) limits uploads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--no-cache\fP[=false] \fB--no-cache\fP[=false]
@ -90,7 +90,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--pack-size\fP=0 \fB--pack-size\fP=0
set target pack size in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE) set target pack \fB\fCsize\fR in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE)
.PP .PP
\fB--password-command\fP="" \fB--password-command\fP=""
@ -118,7 +118,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB-v\fP, \fB--verbose\fP[=0] \fB-v\fP, \fB--verbose\fP[=0]
be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 3) be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 2)
.SH SEE ALSO .SH SEE ALSO

View file

@ -58,11 +58,11 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--limit-download\fP=0 \fB--limit-download\fP=0
limits downloads to a maximum rate in KiB/s. (default: unlimited) limits downloads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--limit-upload\fP=0 \fB--limit-upload\fP=0
limits uploads to a maximum rate in KiB/s. (default: unlimited) limits uploads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--no-cache\fP[=false] \fB--no-cache\fP[=false]
@ -78,7 +78,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--pack-size\fP=0 \fB--pack-size\fP=0
set target pack size in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE) set target pack \fB\fCsize\fR in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE)
.PP .PP
\fB--password-command\fP="" \fB--password-command\fP=""
@ -106,7 +106,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB-v\fP, \fB--verbose\fP[=0] \fB-v\fP, \fB--verbose\fP[=0]
be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 3) be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 2)
.SH SEE ALSO .SH SEE ALSO

View file

@ -51,7 +51,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--path\fP=[] \fB--path\fP=[]
only consider snapshots which include this (absolute) \fB\fCpath\fR, when snapshot ID "latest" is given (can be specified multiple times) only consider snapshots including this (absolute) \fB\fCpath\fR, when snapshot ID "latest" is given (can be specified multiple times)
.PP .PP
\fB--recursive\fP[=false] \fB--recursive\fP[=false]
@ -59,7 +59,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--tag\fP=[] \fB--tag\fP=[]
only consider snapshots which include this \fB\fCtaglist\fR, when snapshot ID "latest" is given (can be specified multiple times) only consider snapshots including \fB\fCtag[,tag,...]\fR, when snapshot ID "latest" is given (can be specified multiple times)
.SH OPTIONS INHERITED FROM PARENT COMMANDS .SH OPTIONS INHERITED FROM PARENT COMMANDS
@ -93,11 +93,11 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--limit-download\fP=0 \fB--limit-download\fP=0
limits downloads to a maximum rate in KiB/s. (default: unlimited) limits downloads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--limit-upload\fP=0 \fB--limit-upload\fP=0
limits uploads to a maximum rate in KiB/s. (default: unlimited) limits uploads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--no-cache\fP[=false] \fB--no-cache\fP[=false]
@ -113,7 +113,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--pack-size\fP=0 \fB--pack-size\fP=0
set target pack size in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE) set target pack \fB\fCsize\fR in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE)
.PP .PP
\fB--password-command\fP="" \fB--password-command\fP=""
@ -141,7 +141,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB-v\fP, \fB--verbose\fP[=0] \fB-v\fP, \fB--verbose\fP[=0]
be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 3) be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 2)
.SH SEE ALSO .SH SEE ALSO

View file

@ -64,11 +64,11 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--limit-download\fP=0 \fB--limit-download\fP=0
limits downloads to a maximum rate in KiB/s. (default: unlimited) limits downloads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--limit-upload\fP=0 \fB--limit-upload\fP=0
limits uploads to a maximum rate in KiB/s. (default: unlimited) limits uploads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--no-cache\fP[=false] \fB--no-cache\fP[=false]
@ -84,7 +84,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--pack-size\fP=0 \fB--pack-size\fP=0
set target pack size in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE) set target pack \fB\fCsize\fR in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE)
.PP .PP
\fB--password-command\fP="" \fB--password-command\fP=""
@ -112,7 +112,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB-v\fP, \fB--verbose\fP[=0] \fB-v\fP, \fB--verbose\fP[=0]
be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 3) be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 2)
.SH SEE ALSO .SH SEE ALSO

View file

@ -84,7 +84,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB-H\fP, \fB--host\fP=[] \fB-H\fP, \fB--host\fP=[]
only consider snapshots for this host (can be specified multiple times) only consider snapshots for this \fB\fChost\fR (can be specified multiple times)
.PP .PP
\fB--no-default-permissions\fP[=false] \fB--no-default-permissions\fP[=false]
@ -96,7 +96,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--path\fP=[] \fB--path\fP=[]
only consider snapshots which include this (absolute) \fB\fCpath\fR only consider snapshots including this (absolute) \fB\fCpath\fR (can be specified multiple times)
.PP .PP
\fB--path-template\fP=[] \fB--path-template\fP=[]
@ -104,7 +104,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--tag\fP=[] \fB--tag\fP=[]
only consider snapshots which include this \fB\fCtaglist\fR only consider snapshots including \fB\fCtag[,tag,...]\fR (can be specified multiple times)
.PP .PP
\fB--time-template\fP="2006-01-02T15:04:05Z07:00" \fB--time-template\fP="2006-01-02T15:04:05Z07:00"
@ -142,11 +142,11 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--limit-download\fP=0 \fB--limit-download\fP=0
limits downloads to a maximum rate in KiB/s. (default: unlimited) limits downloads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--limit-upload\fP=0 \fB--limit-upload\fP=0
limits uploads to a maximum rate in KiB/s. (default: unlimited) limits uploads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--no-cache\fP[=false] \fB--no-cache\fP[=false]
@ -162,7 +162,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--pack-size\fP=0 \fB--pack-size\fP=0
set target pack size in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE) set target pack \fB\fCsize\fR in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE)
.PP .PP
\fB--password-command\fP="" \fB--password-command\fP=""
@ -190,7 +190,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB-v\fP, \fB--verbose\fP[=0] \fB-v\fP, \fB--verbose\fP[=0]
be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 3) be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 2)
.SH SEE ALSO .SH SEE ALSO

View file

@ -87,11 +87,11 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--limit-download\fP=0 \fB--limit-download\fP=0
limits downloads to a maximum rate in KiB/s. (default: unlimited) limits downloads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--limit-upload\fP=0 \fB--limit-upload\fP=0
limits uploads to a maximum rate in KiB/s. (default: unlimited) limits uploads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--no-cache\fP[=false] \fB--no-cache\fP[=false]
@ -107,7 +107,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--pack-size\fP=0 \fB--pack-size\fP=0
set target pack size in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE) set target pack \fB\fCsize\fR in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE)
.PP .PP
\fB--password-command\fP="" \fB--password-command\fP=""
@ -135,7 +135,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB-v\fP, \fB--verbose\fP[=0] \fB-v\fP, \fB--verbose\fP[=0]
be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 3) be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 2)
.SH SEE ALSO .SH SEE ALSO

View file

@ -63,11 +63,11 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--limit-download\fP=0 \fB--limit-download\fP=0
limits downloads to a maximum rate in KiB/s. (default: unlimited) limits downloads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--limit-upload\fP=0 \fB--limit-upload\fP=0
limits uploads to a maximum rate in KiB/s. (default: unlimited) limits uploads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--no-cache\fP[=false] \fB--no-cache\fP[=false]
@ -83,7 +83,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--pack-size\fP=0 \fB--pack-size\fP=0
set target pack size in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE) set target pack \fB\fCsize\fR in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE)
.PP .PP
\fB--password-command\fP="" \fB--password-command\fP=""
@ -111,7 +111,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB-v\fP, \fB--verbose\fP[=0] \fB-v\fP, \fB--verbose\fP[=0]
be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 3) be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 2)
.SH SEE ALSO .SH SEE ALSO

View file

@ -60,11 +60,11 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--limit-download\fP=0 \fB--limit-download\fP=0
limits downloads to a maximum rate in KiB/s. (default: unlimited) limits downloads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--limit-upload\fP=0 \fB--limit-upload\fP=0
limits uploads to a maximum rate in KiB/s. (default: unlimited) limits uploads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--no-cache\fP[=false] \fB--no-cache\fP[=false]
@ -80,7 +80,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--pack-size\fP=0 \fB--pack-size\fP=0
set target pack size in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE) set target pack \fB\fCsize\fR in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE)
.PP .PP
\fB--password-command\fP="" \fB--password-command\fP=""
@ -108,7 +108,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB-v\fP, \fB--verbose\fP[=0] \fB-v\fP, \fB--verbose\fP[=0]
be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 3) be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 2)
.SH SEE ALSO .SH SEE ALSO

View file

@ -37,7 +37,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB-H\fP, \fB--host\fP=[] \fB-H\fP, \fB--host\fP=[]
only consider snapshots for this host when the snapshot ID is "latest" (can be specified multiple times) only consider snapshots for this \fB\fChost\fR, when snapshot ID "latest" is given (can be specified multiple times)
.PP .PP
\fB--iexclude\fP=[] \fB--iexclude\fP=[]
@ -53,11 +53,15 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--path\fP=[] \fB--path\fP=[]
only consider snapshots which include this (absolute) \fB\fCpath\fR for snapshot ID "latest" only consider snapshots including this (absolute) \fB\fCpath\fR, when snapshot ID "latest" is given (can be specified multiple times)
.PP
\fB--sparse\fP[=false]
restore files as sparse
.PP .PP
\fB--tag\fP=[] \fB--tag\fP=[]
only consider snapshots which include this \fB\fCtaglist\fR for snapshot ID "latest" only consider snapshots including \fB\fCtag[,tag,...]\fR, when snapshot ID "latest" is given (can be specified multiple times)
.PP .PP
\fB-t\fP, \fB--target\fP="" \fB-t\fP, \fB--target\fP=""
@ -99,11 +103,11 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--limit-download\fP=0 \fB--limit-download\fP=0
limits downloads to a maximum rate in KiB/s. (default: unlimited) limits downloads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--limit-upload\fP=0 \fB--limit-upload\fP=0
limits uploads to a maximum rate in KiB/s. (default: unlimited) limits uploads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--no-cache\fP[=false] \fB--no-cache\fP[=false]
@ -119,7 +123,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--pack-size\fP=0 \fB--pack-size\fP=0
set target pack size in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE) set target pack \fB\fCsize\fR in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE)
.PP .PP
\fB--password-command\fP="" \fB--password-command\fP=""
@ -147,7 +151,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB-v\fP, \fB--verbose\fP[=0] \fB-v\fP, \fB--verbose\fP[=0]
be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 3) be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 2)
.SH SEE ALSO .SH SEE ALSO

167
doc/man/restic-rewrite.1 Normal file
View file

@ -0,0 +1,167 @@
.nh
.TH "restic backup" "1" "Jan 2017" "generated by \fB\fCrestic generate\fR" ""
.SH NAME
.PP
restic-rewrite - Rewrite snapshots to exclude unwanted files
.SH SYNOPSIS
.PP
\fBrestic rewrite [flags] [snapshotID ...]\fP
.SH DESCRIPTION
.PP
The "rewrite" command excludes files from existing snapshots. It creates new
snapshots containing the same data as the original ones, but without the files
you specify to exclude. All metadata (time, host, tags) will be preserved.
.PP
The snapshots to rewrite are specified using the --host, --tag and --path options,
or by providing a list of snapshot IDs. Please note that specifying neither any of
these options nor a snapshot ID will cause the command to rewrite all snapshots.
.PP
The special tag 'rewrite' will be added to the new snapshots to distinguish
them from the original ones, unless --forget is used. If the --forget option is
used, the original snapshots will instead be directly removed from the repository.
.PP
Please note that the --forget option only removes the snapshots and not the actual
data stored in the repository. In order to delete the no longer referenced data,
use the "prune" command.
.SH EXIT STATUS
.PP
Exit status is 0 if the command was successful, and non-zero if there was any error.
.SH OPTIONS
.PP
\fB-n\fP, \fB--dry-run\fP[=false]
do not do anything, just print what would be done
.PP
\fB-e\fP, \fB--exclude\fP=[]
exclude a \fB\fCpattern\fR (can be specified multiple times)
.PP
\fB--exclude-file\fP=[]
read exclude patterns from a \fB\fCfile\fR (can be specified multiple times)
.PP
\fB--forget\fP[=false]
remove original snapshots after creating new ones
.PP
\fB-h\fP, \fB--help\fP[=false]
help for rewrite
.PP
\fB-H\fP, \fB--host\fP=[]
only consider snapshots for this \fB\fChost\fR (can be specified multiple times)
.PP
\fB--iexclude\fP=[]
same as --exclude \fB\fCpattern\fR but ignores the casing of filenames
.PP
\fB--iexclude-file\fP=[]
same as --exclude-file but ignores casing of \fB\fCfile\fRnames in patterns
.PP
\fB--path\fP=[]
only consider snapshots including this (absolute) \fB\fCpath\fR (can be specified multiple times)
.PP
\fB--tag\fP=[]
only consider snapshots including \fB\fCtag[,tag,...]\fR (can be specified multiple times)
.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 \fB\fCdirectory\fR\&. (default: use system default cache directory)
.PP
\fB--cleanup-cache\fP[=false]
auto remove old cache directories
.PP
\fB--compression\fP=auto
compression mode (only available for repository format version 2), one of (auto|off|max)
.PP
\fB--insecure-tls\fP[=false]
skip TLS certificate verification when connecting to the repository (insecure)
.PP
\fB--json\fP[=false]
set output mode to JSON for commands that support it
.PP
\fB--key-hint\fP=""
\fB\fCkey\fR ID of key to try decrypting first (default: $RESTIC_KEY_HINT)
.PP
\fB--limit-download\fP=0
limits downloads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP
\fB--limit-upload\fP=0
limits uploads to a maximum \fB\fCrate\fR 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 repository, this allows some operations on read-only repositories
.PP
\fB-o\fP, \fB--option\fP=[]
set extended option (\fB\fCkey=value\fR, can be specified multiple times)
.PP
\fB--pack-size\fP=0
set target pack \fB\fCsize\fR in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE)
.PP
\fB--password-command\fP=""
shell \fB\fCcommand\fR to obtain the repository password from (default: $RESTIC_PASSWORD_COMMAND)
.PP
\fB-p\fP, \fB--password-file\fP=""
\fB\fCfile\fR to read the repository password from (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=""
\fB\fCrepository\fR to backup to or restore from (default: $RESTIC_REPOSITORY)
.PP
\fB--repository-file\fP=""
\fB\fCfile\fR to read the repository location from (default: $RESTIC_REPOSITORY_FILE)
.PP
\fB--tls-client-cert\fP=""
path to a \fB\fCfile\fR containing PEM encoded TLS client certificate and private key
.PP
\fB-v\fP, \fB--verbose\fP[=0]
be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 2)
.SH SEE ALSO
.PP
\fBrestic(1)\fP

View file

@ -65,11 +65,11 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--limit-download\fP=0 \fB--limit-download\fP=0
limits downloads to a maximum rate in KiB/s. (default: unlimited) limits downloads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--limit-upload\fP=0 \fB--limit-upload\fP=0
limits uploads to a maximum rate in KiB/s. (default: unlimited) limits uploads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--no-cache\fP[=false] \fB--no-cache\fP[=false]
@ -85,7 +85,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--pack-size\fP=0 \fB--pack-size\fP=0
set target pack size in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE) set target pack \fB\fCsize\fR in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE)
.PP .PP
\fB--password-command\fP="" \fB--password-command\fP=""
@ -113,7 +113,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB-v\fP, \fB--verbose\fP[=0] \fB-v\fP, \fB--verbose\fP[=0]
be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 3) be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 2)
.SH SEE ALSO .SH SEE ALSO

View file

@ -44,11 +44,11 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--path\fP=[] \fB--path\fP=[]
only consider snapshots for this \fB\fCpath\fR (can be specified multiple times) only consider snapshots including this (absolute) \fB\fCpath\fR (can be specified multiple times)
.PP .PP
\fB--tag\fP=[] \fB--tag\fP=[]
only consider snapshots which include this \fB\fCtaglist\fR in the format \fB\fCtag[,tag,...]\fR (can be specified multiple times) only consider snapshots including \fB\fCtag[,tag,...]\fR (can be specified multiple times)
.SH OPTIONS INHERITED FROM PARENT COMMANDS .SH OPTIONS INHERITED FROM PARENT COMMANDS
@ -82,11 +82,11 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--limit-download\fP=0 \fB--limit-download\fP=0
limits downloads to a maximum rate in KiB/s. (default: unlimited) limits downloads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--limit-upload\fP=0 \fB--limit-upload\fP=0
limits uploads to a maximum rate in KiB/s. (default: unlimited) limits uploads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--no-cache\fP[=false] \fB--no-cache\fP[=false]
@ -102,7 +102,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--pack-size\fP=0 \fB--pack-size\fP=0
set target pack size in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE) set target pack \fB\fCsize\fR in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE)
.PP .PP
\fB--password-command\fP="" \fB--password-command\fP=""
@ -130,7 +130,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB-v\fP, \fB--verbose\fP[=0] \fB-v\fP, \fB--verbose\fP[=0]
be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 3) be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 2)
.SH SEE ALSO .SH SEE ALSO

View file

@ -58,7 +58,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB-H\fP, \fB--host\fP=[] \fB-H\fP, \fB--host\fP=[]
only consider snapshots with the given \fB\fChost\fR (can be specified multiple times) only consider snapshots for this \fB\fChost\fR (can be specified multiple times)
.PP .PP
\fB--mode\fP="restore-size" \fB--mode\fP="restore-size"
@ -66,11 +66,11 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--path\fP=[] \fB--path\fP=[]
only consider snapshots which include this (absolute) \fB\fCpath\fR (can be specified multiple times) only consider snapshots including this (absolute) \fB\fCpath\fR (can be specified multiple times)
.PP .PP
\fB--tag\fP=[] \fB--tag\fP=[]
only consider snapshots which include this \fB\fCtaglist\fR in the format \fB\fCtag[,tag,...]\fR (can be specified multiple times) only consider snapshots including \fB\fCtag[,tag,...]\fR (can be specified multiple times)
.SH OPTIONS INHERITED FROM PARENT COMMANDS .SH OPTIONS INHERITED FROM PARENT COMMANDS
@ -104,11 +104,11 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--limit-download\fP=0 \fB--limit-download\fP=0
limits downloads to a maximum rate in KiB/s. (default: unlimited) limits downloads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--limit-upload\fP=0 \fB--limit-upload\fP=0
limits uploads to a maximum rate in KiB/s. (default: unlimited) limits uploads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--no-cache\fP[=false] \fB--no-cache\fP[=false]
@ -124,7 +124,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--pack-size\fP=0 \fB--pack-size\fP=0
set target pack size in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE) set target pack \fB\fCsize\fR in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE)
.PP .PP
\fB--password-command\fP="" \fB--password-command\fP=""
@ -152,7 +152,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB-v\fP, \fB--verbose\fP[=0] \fB-v\fP, \fB--verbose\fP[=0]
be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 3) be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 2)
.SH SEE ALSO .SH SEE ALSO

View file

@ -39,11 +39,11 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB-H\fP, \fB--host\fP=[] \fB-H\fP, \fB--host\fP=[]
only consider snapshots for this \fB\fChost\fR, when no snapshot ID is given (can be specified multiple times) only consider snapshots for this \fB\fChost\fR (can be specified multiple times)
.PP .PP
\fB--path\fP=[] \fB--path\fP=[]
only consider snapshots which include this (absolute) \fB\fCpath\fR, when no snapshot-ID is given only consider snapshots including this (absolute) \fB\fCpath\fR (can be specified multiple times)
.PP .PP
\fB--remove\fP=[] \fB--remove\fP=[]
@ -55,7 +55,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--tag\fP=[] \fB--tag\fP=[]
only consider snapshots which include this \fB\fCtaglist\fR, when no snapshot-ID is given only consider snapshots including \fB\fCtag[,tag,...]\fR (can be specified multiple times)
.SH OPTIONS INHERITED FROM PARENT COMMANDS .SH OPTIONS INHERITED FROM PARENT COMMANDS
@ -89,11 +89,11 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--limit-download\fP=0 \fB--limit-download\fP=0
limits downloads to a maximum rate in KiB/s. (default: unlimited) limits downloads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--limit-upload\fP=0 \fB--limit-upload\fP=0
limits uploads to a maximum rate in KiB/s. (default: unlimited) limits uploads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--no-cache\fP[=false] \fB--no-cache\fP[=false]
@ -109,7 +109,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--pack-size\fP=0 \fB--pack-size\fP=0
set target pack size in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE) set target pack \fB\fCsize\fR in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE)
.PP .PP
\fB--password-command\fP="" \fB--password-command\fP=""
@ -137,7 +137,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB-v\fP, \fB--verbose\fP[=0] \fB-v\fP, \fB--verbose\fP[=0]
be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 3) be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 2)
.SH SEE ALSO .SH SEE ALSO

View file

@ -62,11 +62,11 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--limit-download\fP=0 \fB--limit-download\fP=0
limits downloads to a maximum rate in KiB/s. (default: unlimited) limits downloads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--limit-upload\fP=0 \fB--limit-upload\fP=0
limits uploads to a maximum rate in KiB/s. (default: unlimited) limits uploads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--no-cache\fP[=false] \fB--no-cache\fP[=false]
@ -82,7 +82,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--pack-size\fP=0 \fB--pack-size\fP=0
set target pack size in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE) set target pack \fB\fCsize\fR in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE)
.PP .PP
\fB--password-command\fP="" \fB--password-command\fP=""
@ -110,7 +110,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB-v\fP, \fB--verbose\fP[=0] \fB-v\fP, \fB--verbose\fP[=0]
be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 3) be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 2)
.SH SEE ALSO .SH SEE ALSO

View file

@ -59,11 +59,11 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--limit-download\fP=0 \fB--limit-download\fP=0
limits downloads to a maximum rate in KiB/s. (default: unlimited) limits downloads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--limit-upload\fP=0 \fB--limit-upload\fP=0
limits uploads to a maximum rate in KiB/s. (default: unlimited) limits uploads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--no-cache\fP[=false] \fB--no-cache\fP[=false]
@ -79,7 +79,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB--pack-size\fP=0 \fB--pack-size\fP=0
set target pack size in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE) set target pack \fB\fCsize\fR in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE)
.PP .PP
\fB--password-command\fP="" \fB--password-command\fP=""
@ -107,7 +107,7 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
.PP .PP
\fB-v\fP, \fB--verbose\fP[=0] \fB-v\fP, \fB--verbose\fP[=0]
be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 3) be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 2)
.SH SEE ALSO .SH SEE ALSO

View file

@ -52,11 +52,11 @@ directories in an encrypted repository stored on different backends.
.PP .PP
\fB--limit-download\fP=0 \fB--limit-download\fP=0
limits downloads to a maximum rate in KiB/s. (default: unlimited) limits downloads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--limit-upload\fP=0 \fB--limit-upload\fP=0
limits uploads to a maximum rate in KiB/s. (default: unlimited) limits uploads to a maximum \fB\fCrate\fR in KiB/s. (default: unlimited)
.PP .PP
\fB--no-cache\fP[=false] \fB--no-cache\fP[=false]
@ -72,7 +72,7 @@ directories in an encrypted repository stored on different backends.
.PP .PP
\fB--pack-size\fP=0 \fB--pack-size\fP=0
set target pack size in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE) set target pack \fB\fCsize\fR in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE)
.PP .PP
\fB--password-command\fP="" \fB--password-command\fP=""
@ -100,9 +100,9 @@ directories in an encrypted repository stored on different backends.
.PP .PP
\fB-v\fP, \fB--verbose\fP[=0] \fB-v\fP, \fB--verbose\fP[=0]
be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 3) be verbose (specify multiple times or a level using --verbose=\fB\fCn\fR, max level/times is 2)
.SH SEE ALSO .SH SEE ALSO
.PP .PP
\fBrestic-backup(1)\fP, \fBrestic-cache(1)\fP, \fBrestic-cat(1)\fP, \fBrestic-check(1)\fP, \fBrestic-copy(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-recover(1)\fP, \fBrestic-restore(1)\fP, \fBrestic-self-update(1)\fP, \fBrestic-snapshots(1)\fP, \fBrestic-stats(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-copy(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-recover(1)\fP, \fBrestic-restore(1)\fP, \fBrestic-rewrite(1)\fP, \fBrestic-self-update(1)\fP, \fBrestic-snapshots(1)\fP, \fBrestic-stats(1)\fP, \fBrestic-tag(1)\fP, \fBrestic-unlock(1)\fP, \fBrestic-version(1)\fP

View file

@ -0,0 +1,230 @@
# powershell completion for restic -*- shell-script -*-
function __restic_debug {
if ($env:BASH_COMP_DEBUG_FILE) {
"$args" | Out-File -Append -FilePath "$env:BASH_COMP_DEBUG_FILE"
}
}
filter __restic_escapeStringWithSpecialChars {
$_ -replace '\s|#|@|\$|;|,|''|\{|\}|\(|\)|"|`|\||<|>|&','`$&'
}
[scriptblock]$__resticCompleterBlock = {
param(
$WordToComplete,
$CommandAst,
$CursorPosition
)
# Get the current command line and convert into a string
$Command = $CommandAst.CommandElements
$Command = "$Command"
__restic_debug ""
__restic_debug "========= starting completion logic =========="
__restic_debug "WordToComplete: $WordToComplete Command: $Command CursorPosition: $CursorPosition"
# The user could have moved the cursor backwards on the command-line.
# We need to trigger completion from the $CursorPosition location, so we need
# to truncate the command-line ($Command) up to the $CursorPosition location.
# Make sure the $Command is longer then the $CursorPosition before we truncate.
# This happens because the $Command does not include the last space.
if ($Command.Length -gt $CursorPosition) {
$Command=$Command.Substring(0,$CursorPosition)
}
__restic_debug "Truncated command: $Command"
$ShellCompDirectiveError=1
$ShellCompDirectiveNoSpace=2
$ShellCompDirectiveNoFileComp=4
$ShellCompDirectiveFilterFileExt=8
$ShellCompDirectiveFilterDirs=16
# Prepare the command to request completions for the program.
# Split the command at the first space to separate the program and arguments.
$Program,$Arguments = $Command.Split(" ",2)
$RequestComp="$Program __completeNoDesc $Arguments"
__restic_debug "RequestComp: $RequestComp"
# we cannot use $WordToComplete because it
# has the wrong values if the cursor was moved
# so use the last argument
if ($WordToComplete -ne "" ) {
$WordToComplete = $Arguments.Split(" ")[-1]
}
__restic_debug "New WordToComplete: $WordToComplete"
# Check for flag with equal sign
$IsEqualFlag = ($WordToComplete -Like "--*=*" )
if ( $IsEqualFlag ) {
__restic_debug "Completing equal sign flag"
# Remove the flag part
$Flag,$WordToComplete = $WordToComplete.Split("=",2)
}
if ( $WordToComplete -eq "" -And ( -Not $IsEqualFlag )) {
# If the last parameter is complete (there is a space following it)
# We add an extra empty parameter so we can indicate this to the go method.
__restic_debug "Adding extra empty parameter"
# We need to use `"`" to pass an empty argument a "" or '' does not work!!!
$RequestComp="$RequestComp" + ' `"`"'
}
__restic_debug "Calling $RequestComp"
# First disable ActiveHelp which is not supported for Powershell
$env:RESTIC_ACTIVE_HELP=0
#call the command store the output in $out and redirect stderr and stdout to null
# $Out is an array contains each line per element
Invoke-Expression -OutVariable out "$RequestComp" 2>&1 | Out-Null
# get directive from last line
[int]$Directive = $Out[-1].TrimStart(':')
if ($Directive -eq "") {
# There is no directive specified
$Directive = 0
}
__restic_debug "The completion directive is: $Directive"
# remove directive (last element) from out
$Out = $Out | Where-Object { $_ -ne $Out[-1] }
__restic_debug "The completions are: $Out"
if (($Directive -band $ShellCompDirectiveError) -ne 0 ) {
# Error code. No completion.
__restic_debug "Received error from custom completion go code"
return
}
$Longest = 0
$Values = $Out | ForEach-Object {
#Split the output in name and description
$Name, $Description = $_.Split("`t",2)
__restic_debug "Name: $Name Description: $Description"
# Look for the longest completion so that we can format things nicely
if ($Longest -lt $Name.Length) {
$Longest = $Name.Length
}
# Set the description to a one space string if there is none set.
# This is needed because the CompletionResult does not accept an empty string as argument
if (-Not $Description) {
$Description = " "
}
@{Name="$Name";Description="$Description"}
}
$Space = " "
if (($Directive -band $ShellCompDirectiveNoSpace) -ne 0 ) {
# remove the space here
__restic_debug "ShellCompDirectiveNoSpace is called"
$Space = ""
}
if ((($Directive -band $ShellCompDirectiveFilterFileExt) -ne 0 ) -or
(($Directive -band $ShellCompDirectiveFilterDirs) -ne 0 )) {
__restic_debug "ShellCompDirectiveFilterFileExt ShellCompDirectiveFilterDirs are not supported"
# return here to prevent the completion of the extensions
return
}
$Values = $Values | Where-Object {
# filter the result
$_.Name -like "$WordToComplete*"
# Join the flag back if we have an equal sign flag
if ( $IsEqualFlag ) {
__restic_debug "Join the equal sign flag back to the completion value"
$_.Name = $Flag + "=" + $_.Name
}
}
if (($Directive -band $ShellCompDirectiveNoFileComp) -ne 0 ) {
__restic_debug "ShellCompDirectiveNoFileComp is called"
if ($Values.Length -eq 0) {
# Just print an empty string here so the
# shell does not start to complete paths.
# We cannot use CompletionResult here because
# it does not accept an empty string as argument.
""
return
}
}
# Get the current mode
$Mode = (Get-PSReadLineKeyHandler | Where-Object {$_.Key -eq "Tab" }).Function
__restic_debug "Mode: $Mode"
$Values | ForEach-Object {
# store temporary because switch will overwrite $_
$comp = $_
# PowerShell supports three different completion modes
# - TabCompleteNext (default windows style - on each key press the next option is displayed)
# - Complete (works like bash)
# - MenuComplete (works like zsh)
# You set the mode with Set-PSReadLineKeyHandler -Key Tab -Function <mode>
# CompletionResult Arguments:
# 1) CompletionText text to be used as the auto completion result
# 2) ListItemText text to be displayed in the suggestion list
# 3) ResultType type of completion result
# 4) ToolTip text for the tooltip with details about the object
switch ($Mode) {
# bash like
"Complete" {
if ($Values.Length -eq 1) {
__restic_debug "Only one completion left"
# insert space after value
[System.Management.Automation.CompletionResult]::new($($comp.Name | __restic_escapeStringWithSpecialChars) + $Space, "$($comp.Name)", 'ParameterValue', "$($comp.Description)")
} else {
# Add the proper number of spaces to align the descriptions
while($comp.Name.Length -lt $Longest) {
$comp.Name = $comp.Name + " "
}
# Check for empty description and only add parentheses if needed
if ($($comp.Description) -eq " " ) {
$Description = ""
} else {
$Description = " ($($comp.Description))"
}
[System.Management.Automation.CompletionResult]::new("$($comp.Name)$Description", "$($comp.Name)$Description", 'ParameterValue', "$($comp.Description)")
}
}
# zsh like
"MenuComplete" {
# insert space after value
# MenuComplete will automatically show the ToolTip of
# the highlighted value at the bottom of the suggestions.
[System.Management.Automation.CompletionResult]::new($($comp.Name | __restic_escapeStringWithSpecialChars) + $Space, "$($comp.Name)", 'ParameterValue', "$($comp.Description)")
}
# TabCompleteNext and in case we get something unknown
Default {
# Like MenuComplete but we don't want to add a space here because
# the user need to press space anyway to get the completion.
# Description will not be shown because that's not possible with TabCompleteNext
[System.Management.Automation.CompletionResult]::new($($comp.Name | __restic_escapeStringWithSpecialChars), "$($comp.Name)", 'ParameterValue', "$($comp.Description)")
}
}
}
}
Register-ArgumentCompleter -CommandName 'restic' -ScriptBlock $__resticCompleterBlock