"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
Add help to remote chooser in rclone config - fixes #43
Nick Craig-Woode08e35984c08
diff --git a/amazonclouddrive/amazonclouddrive.go b/amazonclouddrive/amazonclouddrive.goindex 5a5869748..094d04814 100644--- a/amazonclouddrive/amazonclouddrive.go+++ b/amazonclouddrive/amazonclouddrive.go@@ -63,8 +63,9 @@ var (// Register with Fsfunc init() {fs.Register(&fs.RegInfo{- Name: "amazon cloud drive",- NewFs: NewFs,+ Name: "amazon cloud drive",+ Description: "Amazon Cloud Drive",+ NewFs: NewFs,Config: func(name string) {err := oauthutil.Config("amazon cloud drive", name, acdConfig)if err != nil {diff --git a/b2/b2.go b/b2/b2.goindex e7fc3ab35..8891fe76e 100644--- a/b2/b2.go+++ b/b2/b2.go@@ -40,8 +40,9 @@ const (// Register with Fsfunc init() {fs.Register(&fs.RegInfo{- Name: "b2",- NewFs: NewFs,+ Name: "b2",+ Description: "Backblaze B2",+ NewFs: NewFs,Options: []fs.Option{{Name: "account",Help: "Account ID",diff --git a/drive/drive.go b/drive/drive.goindex d541420e2..034edd9de 100644--- a/drive/drive.go+++ b/drive/drive.go@@ -85,8 +85,9 @@ var (// Register with Fsfunc init() {fs.Register(&fs.RegInfo{- Name: "drive",- NewFs: NewFs,+ Name: "drive",+ Description: "Google Drive",+ NewFs: NewFs,Config: func(name string) {err := oauthutil.Config("drive", name, driveConfig)if err != nil {diff --git a/dropbox/dropbox.go b/dropbox/dropbox.goindex 73aa8a1e9..7ae1cc4ef 100644--- a/dropbox/dropbox.go+++ b/dropbox/dropbox.go@@ -45,9 +45,10 @@ var (// Register with Fsfunc init() {fs.Register(&fs.RegInfo{- Name: "dropbox",- NewFs: NewFs,- Config: configHelper,+ Name: "dropbox",+ Description: "Dropbox",+ NewFs: NewFs,+ Config: configHelper,Options: []fs.Option{{Name: "app_key",Help: "Dropbox App Key - leave blank normally.",diff --git a/fs/config.go b/fs/config.goindex f46e54d77..db6221657 100644--- a/fs/config.go+++ b/fs/config.go@@ -673,14 +673,26 @@ func ChooseOption(o *Option) string {return ReadLine()}-// NewRemote make a new remote from its name-func NewRemote(name string) {- fmt.Printf("What type of source is it?\n")- types := []string{}+// fsOption returns an Option describing the possible remotes+func fsOption() *Option {+ o := &Option{+ Name: "Storage",+ Help: "Type of storage to configure.",+ }for _, item := range fsRegistry {- types = append(types, item.Name)+ example := OptionExample{+ Value: item.Name,+ Help: item.Description,+ }+ o.Examples = append(o.Examples, example)}- newType := Choose("type", types, nil, false)+ o.Examples.Sort()+ return o+}++// NewRemote make a new remote from its name+func NewRemote(name string) {+ newType := ChooseOption(fsOption())ConfigFile.SetValue(name, "type", newType)fs, err := Find(newType)if err != nil {diff --git a/fs/fs.go b/fs/fs.goindex 18140a376..13870b118 100644--- a/fs/fs.go+++ b/fs/fs.go@@ -7,6 +7,7 @@ import ("log""path/filepath""regexp"+ "sort""time")@@ -36,6 +37,8 @@ var (type RegInfo struct {// Name of this fsName string+ // Description of this fs - defaults to Name+ Description string// Create a new file system. If root refers to an existing// object, then it should return a Fs which only returns that// object.@@ -51,9 +54,24 @@ type Option struct {Name stringHelp stringOptional bool- Examples []OptionExample+ Examples OptionExamples}+// OptionExamples is a slice of examples+type OptionExamples []OptionExample++// Len is part of sort.Interface.+func (os OptionExamples) Len() int { return len(os) }++// Swap is part of sort.Interface.+func (os OptionExamples) Swap(i, j int) { os[i], os[j] = os[j], os[i] }++// Less is part of sort.Interface.+func (os OptionExamples) Less(i, j int) bool { return os[i].Help < os[j].Help }++// Sort sorts an OptionExamples+func (os OptionExamples) Sort() { sort.Sort(os) }+// OptionExample describes an example for an Optiontype OptionExample struct {Value stringdiff --git a/googlecloudstorage/googlecloudstorage.go b/googlecloudstorage/googlecloudstorage.goindex aa844e38b..fad5883fd 100644--- a/googlecloudstorage/googlecloudstorage.go+++ b/googlecloudstorage/googlecloudstorage.go@@ -56,8 +56,9 @@ var (// Register with Fsfunc init() {fs.Register(&fs.RegInfo{- Name: "google cloud storage",- NewFs: NewFs,+ Name: "google cloud storage",+ Description: "Google Cloud Storage (this is not Google Drive)",+ NewFs: NewFs,Config: func(name string) {err := oauthutil.Config("google cloud storage", name, storageConfig)if err != nil {diff --git a/hubic/hubic.go b/hubic/hubic.goindex 44752c575..2fc63faac 100644--- a/hubic/hubic.go+++ b/hubic/hubic.go@@ -45,8 +45,9 @@ var (// Register with Fsfunc init() {fs.Register(&fs.RegInfo{- Name: "hubic",- NewFs: NewFs,+ Name: "hubic",+ Description: "Hubic",+ NewFs: NewFs,Config: func(name string) {err := oauthutil.Config("hubic", name, oauthConfig)if err != nil {diff --git a/local/local.go b/local/local.goindex a2f70845f..cde0100c3 100644--- a/local/local.go+++ b/local/local.go@@ -20,8 +20,9 @@ import (// Register with Fsfunc init() {fsi := &fs.RegInfo{- Name: "local",- NewFs: NewFs,+ Name: "local",+ Description: "Local Disk",+ NewFs: NewFs,Options: []fs.Option{fs.Option{Name: "nounc",Help: "Disable UNC (long path names) conversion on Windows",diff --git a/onedrive/onedrive.go b/onedrive/onedrive.goindex f7684ca74..fc557cc36 100644--- a/onedrive/onedrive.go+++ b/onedrive/onedrive.go@@ -56,8 +56,9 @@ var (// Register with Fsfunc init() {fs.Register(&fs.RegInfo{- Name: "onedrive",- NewFs: NewFs,+ Name: "onedrive",+ Description: "Microsoft OneDrive",+ NewFs: NewFs,Config: func(name string) {err := oauthutil.Config("onedrive", name, oauthConfig)if err != nil {diff --git a/s3/s3.go b/s3/s3.goindex 4334bc0c5..5dbbd3470 100644--- a/s3/s3.go+++ b/s3/s3.go@@ -41,8 +41,9 @@ import (// Register with Fsfunc init() {fs.Register(&fs.RegInfo{- Name: "s3",- NewFs: NewFs,+ Name: "s3",+ Description: "Amazon S3 (also Dreamhost, Ceph)",+ NewFs: NewFs,// AWS endpoints: http://docs.amazonwebservices.com/general/latest/gr/rande.html#s3_regionOptions: []fs.Option{{Name: "env_auth",@@ -94,10 +95,10 @@ func init() {Help: "South America (Sao Paulo) Region\nNeeds location constraint sa-east-1.",}, {Value: "other-v2-signature",- Help: "If using an S3 clone that only understands v2 signatures - eg Ceph - set this and make sure you set the endpoint.",+ Help: "If using an S3 clone that only understands v2 signatures\neg Ceph/Dreamhost\nset this and make sure you set the endpoint.",}, {Value: "other-v4-signature",- Help: "If using an S3 clone that understands v4 signatures set this and make sure you set the endpoint.",+ Help: "If using an S3 clone that understands v4 signatures set this\nand make sure you set the endpoint.",}},}, {Name: "endpoint",diff --git a/swift/swift.go b/swift/swift.goindex 8dddf97e8..ab317b852 100644--- a/swift/swift.go+++ b/swift/swift.go@@ -30,8 +30,9 @@ var (// Register with Fsfunc init() {fs.Register(&fs.RegInfo{- Name: "swift",- NewFs: NewFs,+ Name: "swift",+ Description: "Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)",+ NewFs: NewFs,Options: []fs.Option{{Name: "user",Help: "User name to log in.",diff --git a/yandex/yandex.go b/yandex/yandex.goindex 82277fc57..837fbba0b 100644--- a/yandex/yandex.go+++ b/yandex/yandex.go@@ -42,8 +42,9 @@ var (// Register with Fsfunc init() {fs.Register(&fs.RegInfo{- Name: "yandex",- NewFs: NewFs,+ Name: "yandex",+ Description: "Yandex Disk",+ NewFs: NewFs,Config: func(name string) {err := oauthutil.Config("yandex", name, oauthConfig)if err != nil {