"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
cmd/providers: add DefaultStr, ValueStr and Type fields
Nick Craig-Woodac4c8d8dfcd9
diff --git a/fs/fs.go b/fs/fs.goindex 1617cf9ee..ad412f1c7 100644--- a/fs/fs.go+++ b/fs/fs.go@@ -2,6 +2,7 @@package fsimport (+ "encoding/json""fmt""io""io/ioutil"@@ -132,6 +133,29 @@ type Option struct {Advanced bool // set if this is an advanced config option}+// BaseOption is an alias for Option used internally+type BaseOption Option++// MarshalJSON turns an Option into JSON+//+// It adds some generated fields for ease of use+// - DefaultStr - a string rendering of Default+// - ValueStr - a string rendering of Value+// - Type - the type of the option+func (o *Option) MarshalJSON() ([]byte, error) {+ return json.Marshal(struct {+ BaseOption+ DefaultStr string+ ValueStr string+ Type string+ }{+ BaseOption: BaseOption(*o),+ DefaultStr: fmt.Sprint(o.Default),+ ValueStr: o.String(),+ Type: o.Type(),+ })+}+// GetValue gets the current current value which is the default if not setfunc (o *Option) GetValue() interface{} {val := o.Value