From 64917639ef3be3755a7a306215e80e493d497feb Mon Sep 17 00:00:00 2001 From: Bart Date: Sat, 4 Feb 2017 11:47:54 +0100 Subject: [PATCH] Allow --files-from to take a dash (-) for stdin #769 --- src/cmds/restic/cmd_backup.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/cmds/restic/cmd_backup.go b/src/cmds/restic/cmd_backup.go index 15bee2d43..15db1d53d 100644 --- a/src/cmds/restic/cmd_backup.go +++ b/src/cmds/restic/cmd_backup.go @@ -28,7 +28,12 @@ The "backup" command creates a new snapshot and saves the files and directories given as the arguments. `, RunE: func(cmd *cobra.Command, args []string) error { - if backupOptions.Stdin { + stdinDeclaredTwice := backupOptions.Stdin && backupOptions.FilesFrom == "-" + if stdinDeclaredTwice { + return errors.Fatal("unable to use argument '-' and stdin flag together") + } + + if backupOptions.Stdin || backupOptions.FilesFrom == "-" { return readBackupFromStdin(backupOptions, globalOptions, args) }