Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

fs: allow backends to have aliases #5616

Nick Craig-Woodc40129d610e0
diff --git a/fs/config/config.go b/fs/config/config.go
index ca5b0903d..65780c367 100644
--- a/fs/config/config.go
+++ b/fs/config/config.go
@@ -576,6 +576,9 @@ func fsOption() *fs.Option {
Required: true,
}
for _, item := range fs.Registry {
+ if item.Hide {
+ continue
+ }
example := fs.OptionExample{
Value: item.Name,
Help: item.Description,
diff --git a/fs/registry.go b/fs/registry.go
index 4f51062e3..99ca53551 100644
--- a/fs/registry.go
+++ b/fs/registry.go
@@ -36,6 +36,10 @@ type RegInfo struct {
Options Options
// The command help, if any
CommandHelp []CommandHelp
+ // Aliases - other names this backend is known by
+ Aliases []string
+ // Hide - if set don't show in the configurator
+ Hide bool
}
// FileName returns the on disk file name for this backend
@@ -256,6 +260,18 @@ func Register(info *RegInfo) {
info.Prefix = info.Name
}
Registry = append(Registry, info)
+ for _, alias := range info.Aliases {
+ // Copy the info block and rename and hide the alias and options
+ aliasInfo := *info
+ aliasInfo.Name = alias
+ aliasInfo.Prefix = alias
+ aliasInfo.Hide = true
+ aliasInfo.Options = append(Options(nil), info.Options...)
+ for i := range aliasInfo.Options {
+ aliasInfo.Options[i].Hide = OptionHideBoth
+ }
+ Registry = append(Registry, &aliasInfo)
+ }
}
// Find looks for a RegInfo object for the name passed in. The name