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

backend: add description field for all backends

Paul Sternbb679a9def96
diff --git a/cmd/listremotes/listremotes.go b/cmd/listremotes/listremotes.go
index 6f63ba26b..68dd291c6 100644
--- a/cmd/listremotes/listremotes.go
+++ b/cmd/listremotes/listremotes.go
@@ -19,7 +19,7 @@ var (
func init() {
cmd.Root.AddCommand(commandDefinition)
cmdFlags := commandDefinition.Flags()
- flags.BoolVarP(cmdFlags, &listLong, "long", "", listLong, "Show the type as well as names", "")
+ flags.BoolVarP(cmdFlags, &listLong, "long", "", listLong, "Show the type and the description as well as names", "")
}
var commandDefinition = &cobra.Command{
@@ -28,7 +28,7 @@ var commandDefinition = &cobra.Command{
Long: `
rclone listremotes lists all the available remotes from the config file.
-When used with the ` + "`--long`" + ` flag it lists the types too.
+When used with the ` + "`--long`" + ` flag it lists the types and the descriptions too.
`,
Annotations: map[string]string{
"versionIntroduced": "v1.34",
@@ -38,15 +38,21 @@ When used with the ` + "`--long`" + ` flag it lists the types too.
remotes := config.FileSections()
sort.Strings(remotes)
maxlen := 1
+ maxlentype := 1
for _, remote := range remotes {
if len(remote) > maxlen {
maxlen = len(remote)
}
+ t := config.FileGet(remote, "type")
+ if len(t) > maxlentype {
+ maxlentype = len(t)
+ }
}
for _, remote := range remotes {
if listLong {
remoteType := config.FileGet(remote, "type")
- fmt.Printf("%-*s %s\n", maxlen+1, remote+":", remoteType)
+ description := config.FileGet(remote, "description")
+ fmt.Printf("%-*s %-*s %s\n", maxlen+1, remote+":", maxlentype+1, remoteType, description)
} else {
fmt.Printf("%s:\n", remote)
}
diff --git a/fs/config/ui_test.go b/fs/config/ui_test.go
index 6a4d5aee0..172921c9b 100644
--- a/fs/config/ui_test.go
+++ b/fs/config/ui_test.go
@@ -104,6 +104,7 @@ func TestCRUD(t *testing.T) {
"y", // type my own password
"secret", // password
"secret", // repeat
+ "n", // don't edit advanced config
"y", // looks good, save
})
require.NoError(t, config.NewRemote(ctx, "test"))
diff --git a/fs/registry.go b/fs/registry.go
index 1ecd2c305..ddabfd6df 100644
--- a/fs/registry.go
+++ b/fs/registry.go
@@ -19,6 +19,13 @@ import (
// Registry of filesystems
var Registry []*RegInfo
+// optDescription is a basic description option
+var optDescription = Option{
+ Name: "description",
+ Help: "Description of the remote",
+ Advanced: true,
+}
+
// RegInfo provides information about a filesystem
type RegInfo struct {
// Name of this fs
@@ -283,6 +290,7 @@ func Register(info *RegInfo) {
if info.Prefix == "" {
info.Prefix = info.Name
}
+ info.Options = append(info.Options, optDescription)
Registry = append(Registry, info)
for _, alias := range info.Aliases {
// Copy the info block and rename and hide the alias and options