"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
fs/config: add tier to config wizard
dougalc4d87bd6d479
diff --git a/backend/info/info.go b/backend/overview/overview.gosimilarity index 95%rename from backend/info/info.gorename to backend/overview/overview.goindex 2a60b03a9..11af24fd3 100644--- a/backend/info/info.go+++ b/backend/overview/overview.go@@ -1,5 +1,5 @@-// Package info provides info about a backend-package info+// Package overview provides info about a backend+package overviewimport ("fmt"diff --git a/backend/info/info_test.go b/backend/overview/overview_test.gosimilarity index 98%rename from backend/info/info_test.gorename to backend/overview/overview_test.goindex 3b04f06c6..f7441bfb8 100644--- a/backend/info/info_test.go+++ b/backend/overview/overview_test.go@@ -1,4 +1,4 @@-package info+package overviewimport ("testing"diff --git a/docs/data/backends/embed.go b/docs/data/backends/embed.goindex 6d00c636b..5c459848f 100644--- a/docs/data/backends/embed.go+++ b/docs/data/backends/embed.go@@ -4,4 +4,6 @@ package backendsimport "embed"//go:embed *.yaml++// BackendFS contains the backend YAML filesvar BackendFS embed.FSdiff --git a/fs/config/config.go b/fs/config/config.goindex 18b751db3..9f6ec5956 100644--- a/fs/config/config.go+++ b/fs/config/config.go@@ -24,6 +24,7 @@ import ("github.com/rclone/rclone/fs/rc""github.com/rclone/rclone/lib/file""github.com/rclone/rclone/lib/random"+ "github.com/rclone/rclone/lib/terminal")const (@@ -709,6 +710,23 @@ func JSONListProviders() error {return nil}+// colorizeTier applies a color based on level of support+func colorizeTier(tier string) string {+ var color string+ switch tier {+ case "Tier 1", "Tier 2":+ color = terminal.GreenBg+ case "Tier 3":+ color = terminal.YellowBg+ case "Tier 4", "Tier 5":+ color = terminal.RedBg+ default:+ return tier+ }++ return terminal.BlackFg + color + tier + terminal.Reset+}+// fsOption returns an Option describing the possible remotesfunc fsOption() *fs.Option {o := &fs.Option{@@ -723,7 +741,7 @@ func fsOption() *fs.Option {}example := fs.OptionExample{Value: item.Name,- Help: item.Description,+ Help: item.Description + " - " + colorizeTier(item.Overview.Tier),}o.Examples = append(o.Examples, example)}diff --git a/fs/config/ui.go b/fs/config/ui.goindex 845eb77e7..8e4eaaf90 100644--- a/fs/config/ui.go+++ b/fs/config/ui.go@@ -167,6 +167,8 @@ func Choose(what string, kind string, choices, help []string, defaultValue strinnumber = fmt.Sprintf("%2d", pos)}fmt.Printf("%s %c %s\n", number, sep, line)+ // reapply color for second line+ terminal.WriteString(attributes[(pos-1)%len(attributes)])}}terminal.WriteString(terminal.Reset)diff --git a/fs/registry.go b/fs/registry.goindex a11c57d22..6d50acaf4 100644--- a/fs/registry.go+++ b/fs/registry.go@@ -13,6 +13,7 @@ import ("strings""sync"+ "github.com/rclone/rclone/backend/overview""github.com/rclone/rclone/fs/config/configmap""github.com/rclone/rclone/fs/config/configstruct""github.com/rclone/rclone/lib/errcount"@@ -53,6 +54,8 @@ type RegInfo struct {Hide bool// MetadataInfo help about the metadata in use in this backendMetadataInfo *MetadataInfo+ // Overview about the backend+ Overview *overview.BackendConfig}// FileName returns the on disk file name for this backend@@ -431,6 +434,12 @@ func Register(info *RegInfo) {}info.Options = append(info.Options, optDescription)Registry = append(Registry, info)+ var err error+ info.Overview, err = overview.GetBackendConfig(strings.ReplaceAll(info.Name, " ", ""))+ if err != nil {+ Errorf(nil, "internal error: no overview data found for %q", info.Name)+ info.Overview = new(overview.BackendConfig)+ }for _, alias := range info.Aliases {// Copy the info block and rename and hide the alias and optionsaliasInfo := *info