MCPcopy
hub / github.com/rclone/rclone / Command

Method Command

backend/oracleobjectstorage/command.go:150–177  ·  view source on GitHub ↗

* Command the backend to run a named command The command run is name args may be used to read arguments from opts may be used to read optional arguments from The result should be capable of being JSON encoded If it is a string or a []string it will be shown to the user otherwise it will be JSON en

(ctx context.Context, commandName string, args []string,
	opt map[string]string)

Source from the content-addressed store, hash-verified

148otherwise it will be JSON encoded and shown to the user like that
149*/
150func (f *Fs) Command(ctx context.Context, commandName string, args []string,
151 opt map[string]string) (result any, err error) {
152 // fs.Debugf(f, "command %v, args: %v, opts:%v", commandName, args, opt)
153 switch commandName {
154 case operationRename:
155 if len(args) < 2 {
156 return nil, fmt.Errorf("path to object or its new name to rename is empty")
157 }
158 remote := args[0]
159 newName := args[1]
160 return f.rename(ctx, remote, newName)
161 case operationListMultiPart:
162 return f.listMultipartUploadsAll(ctx)
163 case operationCleanup:
164 maxAge := 24 * time.Hour
165 if opt["max-age"] != "" {
166 maxAge, err = fs.ParseDuration(opt["max-age"])
167 if err != nil {
168 return nil, fmt.Errorf("bad max-age: %w", err)
169 }
170 }
171 return nil, f.cleanUp(ctx, maxAge)
172 case operationRestore:
173 return f.restore(ctx, opt)
174 default:
175 return nil, fs.ErrorCommandNotFound
176 }
177}
178
179func (f *Fs) rename(ctx context.Context, remote, newName string) (any, error) {
180 if remote == "" {

Callers

nothing calls this directly

Calls 6

renameMethod · 0.95
cleanUpMethod · 0.95
restoreMethod · 0.95
ParseDurationFunction · 0.92
ErrorfMethod · 0.45

Tested by

no test coverage detected