diff --git a/CHANGELOG.md b/CHANGELOG.md index ad435b3cd..c68ef1f31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ - Upgraded minimum required Go version to 1.19. ([#583](https://github.com/peak/s5cmd/pull/583)) #### Bugfixes +- Fixed a bug that causes `sync` command with whitespaced flag value to fail. ([#541](https://github.com/peak/s5cmd/issues/541)) - Fixed a bug introduced with `external sort` support in `sync` command which prevents `sync` to an empty destination with `--delete` option. ([#576](https://github.com/peak/s5cmd/issues/576)) - Fixed a bug in `sync` command, which previously caused the command to continue running even if an error was received from the destination bucket. ([#564](https://github.com/peak/s5cmd/issues/564)) - Fixed a bug that causes local files to be lost if downloads fail. ([#479](https://github.com/peak/s5cmd/issues/479)) diff --git a/command/context.go b/command/context.go index 3e3f5d08d..1eb78fb3d 100644 --- a/command/context.go +++ b/command/context.go @@ -73,7 +73,7 @@ func generateCommand(c *cli.Context, cmd string, defaultFlags map[string]interfa flags := []string{} for flagname, flagvalue := range defaultFlags { - flags = append(flags, fmt.Sprintf("--%s=%v", flagname, flagvalue)) + flags = append(flags, fmt.Sprintf("--%s='%v'", flagname, flagvalue)) } isDefaultFlag := func(flagname string) bool { @@ -88,7 +88,7 @@ func generateCommand(c *cli.Context, cmd string, defaultFlags map[string]interfa } for _, flagvalue := range contextValue(c, flagname) { - flags = append(flags, fmt.Sprintf("--%s=%s", flagname, flagvalue)) + flags = append(flags, fmt.Sprintf("--%s='%s'", flagname, flagvalue)) } } diff --git a/command/context_test.go b/command/context_test.go index 3e7536319..d8ab776a3 100644 --- a/command/context_test.go +++ b/command/context_test.go @@ -46,7 +46,7 @@ func TestGenerateCommand(t *testing.T) { mustNewURL(t, "s3://bucket/key1"), mustNewURL(t, "s3://bucket/key2"), }, - expectedCommand: `cp --acl=public-read --raw=true "s3://bucket/key1" "s3://bucket/key2"`, + expectedCommand: `cp --acl='public-read' --raw='true' "s3://bucket/key1" "s3://bucket/key2"`, }, { name: "same-flag-should-be-ignored-if-given-from-both-default-and-cli-flags", @@ -64,7 +64,7 @@ func TestGenerateCommand(t *testing.T) { mustNewURL(t, "s3://bucket/key1"), mustNewURL(t, "s3://bucket/key2"), }, - expectedCommand: `cp --raw=true "s3://bucket/key1" "s3://bucket/key2"`, + expectedCommand: `cp --raw='true' "s3://bucket/key1" "s3://bucket/key2"`, }, { name: "ignore-non-shared-flag", @@ -101,7 +101,7 @@ func TestGenerateCommand(t *testing.T) { mustNewURL(t, "s3://bucket/key1"), mustNewURL(t, "s3://bucket/key2"), }, - expectedCommand: `cp --concurrency=6 --flatten=true --force-glacier-transfer=true --raw=true "s3://bucket/key1" "s3://bucket/key2"`, + expectedCommand: `cp --concurrency='6' --flatten='true' --force-glacier-transfer='true' --raw='true' "s3://bucket/key1" "s3://bucket/key2"`, }, { name: "string-slice-flag", @@ -116,7 +116,7 @@ func TestGenerateCommand(t *testing.T) { mustNewURL(t, "/source/dir"), mustNewURL(t, "s3://bucket/prefix/"), }, - expectedCommand: `cp --exclude=*.log --exclude=*.txt "/source/dir" "s3://bucket/prefix/"`, + expectedCommand: `cp --exclude='*.log' --exclude='*.txt' "/source/dir" "s3://bucket/prefix/"`, }, { name: "command-with-multiple-args",