MCPcopy
hub / github.com/rclone/rclone / Disable

Method Disable

fs/features.go:218–250  ·  view source on GitHub ↗

Disable nil's out the named feature. If it isn't found then it will log a message.

(name string)

Source from the content-addressed store, hash-verified

216// Disable nil's out the named feature. If it isn't found then it
217// will log a message.
218func (ft *Features) Disable(name string) *Features {
219 // Prefix boolean values with ! to set the feature
220 invert := false
221 if strings.HasPrefix(name, "!") {
222 name = name[1:]
223 invert = true
224 }
225 v := reflect.ValueOf(ft).Elem()
226 vType := v.Type()
227 for i := range v.NumField() {
228 vName := vType.Field(i).Name
229 field := v.Field(i)
230 if strings.EqualFold(name, vName) {
231 if !field.CanSet() {
232 Errorf(nil, "Can't set Feature %q", name)
233 } else {
234 if invert {
235 if field.Type().Kind() == reflect.Bool {
236 field.Set(reflect.ValueOf(true))
237 Debugf(nil, "Set feature %q", name)
238 } else {
239 Errorf(nil, "Can't set Feature %q to true", name)
240 }
241 } else {
242 zero := reflect.Zero(field.Type())
243 field.Set(zero)
244 Debugf(nil, "Reset feature %q", name)
245 }
246 }
247 }
248 }
249 return ft
250}
251
252// List returns a slice of all the possible feature names
253func (ft *Features) List() (out []string) {

Callers 9

DisableListMethod · 0.95
TestMoveCopyFunction · 0.80
testPurgeListDeadlockFunction · 0.80
NewFsFunction · 0.80
checkPreReqsMethod · 0.80
TestFeaturesDisableFunction · 0.80
testSyncWithMaxDurationFunction · 0.80
TestMaxTransferFunction · 0.80
TestCopyFileMaxTransferFunction · 0.80

Calls 4

ErrorfFunction · 0.85
DebugfFunction · 0.85
TypeMethod · 0.65
SetMethod · 0.65

Tested by 7

TestMoveCopyFunction · 0.64
testPurgeListDeadlockFunction · 0.64
checkPreReqsMethod · 0.64
TestFeaturesDisableFunction · 0.64
testSyncWithMaxDurationFunction · 0.64
TestMaxTransferFunction · 0.64
TestCopyFileMaxTransferFunction · 0.64