From 4d2aa18273e93fa29863b9f03d188e3f773c8b4c Mon Sep 17 00:00:00 2001 From: "Leo R. Lundgren" Date: Wed, 20 Nov 2019 19:05:27 +0100 Subject: [PATCH] Accept both singular and plural for --group-by (#2330) --- changelog/unreleased/issue-2330 | 6 ++++++ internal/restic/snapshot_group.go | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 changelog/unreleased/issue-2330 diff --git a/changelog/unreleased/issue-2330 b/changelog/unreleased/issue-2330 new file mode 100644 index 000000000..5836ab316 --- /dev/null +++ b/changelog/unreleased/issue-2330 @@ -0,0 +1,6 @@ +Enhancement: Make `--group-by` accept both singular and plural + +One can now use the values `host`/`hosts`, `path`/`paths` and +`tag` / `tags` interchangeably in the `--group-by` argument. + +https://github.com/restic/restic/issues/2330 diff --git a/internal/restic/snapshot_group.go b/internal/restic/snapshot_group.go index f18e0d767..1e5ac18ee 100644 --- a/internal/restic/snapshot_group.go +++ b/internal/restic/snapshot_group.go @@ -31,11 +31,11 @@ func GroupSnapshots(snapshots Snapshots, options string) (map[string]Snapshots, for _, option := range GroupOptionList { switch option { - case "host": + case "host", "hosts": GroupByHost = true - case "paths": + case "path", "paths": GroupByPath = true - case "tags": + case "tag", "tags": GroupByTag = true case "": default: