backup: Improve help text for --stdin-from-command

This commit is contained in:
Michael Eischer 2024-01-21 22:06:54 +01:00
parent 6696195f38
commit 767c2539a0
2 changed files with 6 additions and 5 deletions

View file

@ -3,10 +3,11 @@ Enhancement: Support reading backup from a program's standard output
When reading data from stdin, the `backup` command could not verify whether the When reading data from stdin, the `backup` command could not verify whether the
corresponding command completed successfully. corresponding command completed successfully.
The `backup` command now supports starting an arbitrary command and sourcing The `backup` command now supports the `--stdin-from-command` option. When using
the backup content from its standard output. This enables restic to verify that this option, the arguments to `backup` are interpreted as a command. `backup`
the command completes with exit code zero. A non-zero exit code causes the then executes the command and stores its standard output in the backup. This
backup to fail. enables restic to verify that the command completes with exit code zero. A
non-zero exit code causes the backup to fail.
Example: `restic backup --stdin-from-command mysqldump [...]` Example: `restic backup --stdin-from-command mysqldump [...]`

View file

@ -135,7 +135,7 @@ func init() {
f.StringVar(&backupOptions.ExcludeLargerThan, "exclude-larger-than", "", "max `size` of the files to be backed up (allowed suffixes: k/K, m/M, g/G, t/T)") f.StringVar(&backupOptions.ExcludeLargerThan, "exclude-larger-than", "", "max `size` of the files to be backed up (allowed suffixes: k/K, m/M, g/G, t/T)")
f.BoolVar(&backupOptions.Stdin, "stdin", false, "read backup from stdin") f.BoolVar(&backupOptions.Stdin, "stdin", false, "read backup from stdin")
f.StringVar(&backupOptions.StdinFilename, "stdin-filename", "stdin", "`filename` to use when reading from stdin") f.StringVar(&backupOptions.StdinFilename, "stdin-filename", "stdin", "`filename` to use when reading from stdin")
f.BoolVar(&backupOptions.StdinCommand, "stdin-from-command", false, "execute command and store its stdout") f.BoolVar(&backupOptions.StdinCommand, "stdin-from-command", false, "interpret arguments as command to execute and store its stdout")
f.Var(&backupOptions.Tags, "tag", "add `tags` for the new snapshot in the format `tag[,tag,...]` (can be specified multiple times)") f.Var(&backupOptions.Tags, "tag", "add `tags` for the new snapshot in the format `tag[,tag,...]` (can be specified multiple times)")
f.UintVar(&backupOptions.ReadConcurrency, "read-concurrency", 0, "read `n` files concurrently (default: $RESTIC_READ_CONCURRENCY or 2)") f.UintVar(&backupOptions.ReadConcurrency, "read-concurrency", 0, "read `n` files concurrently (default: $RESTIC_READ_CONCURRENCY or 2)")
f.StringVarP(&backupOptions.Host, "host", "H", "", "set the `hostname` for the snapshot manually. To prevent an expensive rescan use the \"parent\" flag") f.StringVarP(&backupOptions.Host, "host", "H", "", "set the `hostname` for the snapshot manually. To prevent an expensive rescan use the \"parent\" flag")