"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
Represent -1 as "off" for SIZE values
Nick Craig-Woode818b7c206d2
diff --git a/fs/config.go b/fs/config.goindex 98e89cea0..258b57931 100644--- a/fs/config.go+++ b/fs/config.go@@ -102,6 +102,8 @@ func (x SizeSuffix) String() string {scaled := float64(0)suffix := ""switch {+ case x < 0:+ return "off"case x == 0:return "0"case x < 1024:@@ -128,6 +130,10 @@ func (x *SizeSuffix) Set(s string) error {if len(s) == 0 {return fmt.Errorf("Empty string")}+ if strings.ToLower(s) == "off" {+ *x = -1+ return nil+ }suffix := s[len(s)-1]suffixLen := 1var multiplier float64diff --git a/fs/config_test.go b/fs/config_test.goindex e77b272de..a1da2b17d 100644--- a/fs/config_test.go+++ b/fs/config_test.go@@ -18,6 +18,8 @@ func TestSizeSuffixString(t *testing.T) {{1024 * 1024 * 1024, "1G"},{10 * 1024 * 1024 * 1024, "10G"},{10.1 * 1024 * 1024 * 1024, "10.100G"},+ {-1, "off"},+ {-100, "off"},} {ss := SizeSuffix(test.in)got := ss.String()@@ -44,6 +46,8 @@ func TestSizeSuffixSet(t *testing.T) {{"1M", 1024 * 1024, false},{"1.g", 1024 * 1024 * 1024, false},{"10G", 10 * 1024 * 1024 * 1024, false},+ {"off", -1, false},+ {"OFF", -1, false},{"", 0, true},{"1p", 0, true},{"1.p", 0, true},