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

rc: add options/local to see the options configured in the context

Nick Craig-Wood9a21aff4ed75
diff --git a/fs/rc/config.go b/fs/rc/config.go
index 80edc891e..a80f59399 100644
--- a/fs/rc/config.go
+++ b/fs/rc/config.go
@@ -8,6 +8,8 @@ import (
"context"
"github.com/pkg/errors"
+ "github.com/rclone/rclone/fs"
+ "github.com/rclone/rclone/fs/filter"
)
var (
@@ -52,10 +54,14 @@ func init() {
Add(Call{
Path: "options/get",
Fn: rcOptionsGet,
- Title: "Get all the options",
+ Title: "Get all the global options",
Help: `Returns an object where keys are option block names and values are an
object with the current option values in.
+Note that these are the global options which are unaffected by use of
+the _config and _filter parameters. If you wish to read the parameters
+set in _config then use options/config and for _filter use options/filter.
+
This shows the internal names of the option within rclone which should
map to the external options very easily with a few exceptions.
`,
@@ -71,6 +77,36 @@ func rcOptionsGet(ctx context.Context, in Params) (out Params, err error) {
return out, nil
}
+func init() {
+ Add(Call{
+ Path: "options/local",
+ Fn: rcOptionsLocal,
+ Title: "Get the currently active config for this call",
+ Help: `Returns an object with the keys "config" and "filter".
+The "config" key contains the local config and the "filter" key contains
+the local filters.
+
+Note that these are the local options specific to this rc call. If
+_config was not supplied then they will be the global options.
+Likewise with "_filter".
+
+This call is mostly useful for seeing if _config and _filter passing
+is working.
+
+This shows the internal names of the option within rclone which should
+map to the external options very easily with a few exceptions.
+`,
+ })
+}
+
+// Show the current config
+func rcOptionsLocal(ctx context.Context, in Params) (out Params, err error) {
+ out = make(Params)
+ out["config"] = fs.GetConfig(ctx)
+ out["filter"] = filter.GetConfig(ctx)
+ return out, nil
+}
+
func init() {
Add(Call{
Path: "options/set",