From ae441d31348ab714fbe3e0a09d2bc68847617dec Mon Sep 17 00:00:00 2001 From: Quentin Lemaire Date: Mon, 13 Apr 2020 04:29:13 +0200 Subject: [PATCH] fix(backup): Switch tags cobra type to handle comma-separated list --- cmd/restic/cmd_backup.go | 4 ++-- internal/archiver/archiver.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/restic/cmd_backup.go b/cmd/restic/cmd_backup.go index a0831b16e..4769654bf 100644 --- a/cmd/restic/cmd_backup.go +++ b/cmd/restic/cmd_backup.go @@ -91,7 +91,7 @@ type BackupOptions struct { ExcludeLargerThan string Stdin bool StdinFilename string - Tags []string + Tags restic.TagList Host string FilesFrom []string TimeStamp string @@ -121,7 +121,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.BoolVar(&backupOptions.Stdin, "stdin", false, "read backup from stdin") f.StringVar(&backupOptions.StdinFilename, "stdin-filename", "stdin", "`filename` to use when reading from stdin") - f.StringArrayVar(&backupOptions.Tags, "tag", nil, "add a `tag` for the new snapshot (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.StringVarP(&backupOptions.Host, "host", "H", "", "set the `hostname` for the snapshot manually. To prevent an expensive rescan use the \"parent\" flag") f.StringVar(&backupOptions.Host, "hostname", "", "set the `hostname` for the snapshot manually") diff --git a/internal/archiver/archiver.go b/internal/archiver/archiver.go index 42fc03310..367d6e809 100644 --- a/internal/archiver/archiver.go +++ b/internal/archiver/archiver.go @@ -717,7 +717,7 @@ func resolveRelativeTargets(filesys fs.FS, targets []string) ([]string, error) { // SnapshotOptions collect attributes for a new snapshot. type SnapshotOptions struct { - Tags []string + Tags restic.TagList Hostname string Excludes []string Time time.Time