From 917438471eff4557e73f9fc16c2dbff3ee72dfdf Mon Sep 17 00:00:00 2001 From: Ian Fijolek Date: Thu, 3 Nov 2022 16:43:17 -0700 Subject: [PATCH] Fix option adding --- restic.go | 2 +- restic_test.go | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/restic.go b/restic.go index 42cdd2f..04fd434 100644 --- a/restic.go +++ b/restic.go @@ -213,7 +213,7 @@ func (glo ResticGlobalOpts) ToArgs() (args []string) { args = maybeAddArgBool(args, "--no-lock", glo.NoLock) for key, value := range glo.Options { - args = append(args, fmt.Sprintf("--option %s='%s'", key, value)) + args = append(args, "--option", fmt.Sprintf("%s='%s'", key, value)) } return args diff --git a/restic_test.go b/restic_test.go index c173ffe..2adeb42 100644 --- a/restic_test.go +++ b/restic_test.go @@ -50,7 +50,7 @@ func TestGlobalOptions(t *testing.T) { "--cleanup-cache", "--no-cache", "--no-lock", - "--option key='a long value'", + "--option", "key='a long value'", } AssertEqual(t, "args didn't match", expected, args) @@ -213,6 +213,9 @@ func TestResticInterface(t *testing.T) { // nolint:exhaustivestruct GlobalOpts: &main.ResticGlobalOpts{ CacheDir: cacheDir, + Options: map[string]string{ + "s3.storage-class": "REDUCED_REDUNDANCY", + }, }, Cwd: dataDir, }