mirror of
https://github.com/rclone/rclone.git
synced 2024-11-22 08:23:47 +01:00
rc: add options/local to see the options configured in the context
This commit is contained in:
parent
8574a7bd67
commit
9a21aff4ed
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user